With boost 1.73 this initializer makes gcc crash. The argument isn't
needed -- not_a_date_time is the default value for default construction
-- and temoving it works around the compiler bug.
A lokimq header has a range comparison that can trigger a tautological
warning under xenial gcc; make it just a warning even with -Werror is
turned on.
- Replace some boost::bind's with forwarding lambdas
- Properly import boost::bind placeholders (_1, _2, etc.) rather than
relying on the long-deprecated (and now removed) boost behaviour of
importing them into the root namespace.
* recalculate_difficulty: Batch work, avoid LMDB paging error
F Uncaught exception! Failed to get block info in recalculate difficulty: MDB_TXN_FULL: Transaction has too many dirty pages - transaction too big
* recaluculate_difficulty: Reduce batch to 10k, rewrite num_batches
Instead of committing every block, commit everytime we know the DB has
changed and on shutdown. Upon profiling, every block added was taking an
additional ~9ms from HF15 because of `save_settings(...)` writing the
block hash and height to the DB.
If the daemon crashes during operation, then LNS only needs to scan
empty blocks up until that point which shouldn't be too slow and the
exception, not the norm.
This code was only entered when the argument was non-defaulted, but then
accepted `--recalculate-difficulty=0` and rewrote it to recalculate from
height 1 in the lmdb. This changes the argument handling so that
`--recalculate-difficulty=0` now disables the recalculation, and the
default value of 1 now does the recalculation.
At height 526483 a mined block arrived that had *slightly* too little
proof of work, yet difficulties on the network had apparently diverged
enough that half the network accepted it and the other half didn't --
nodes with the correct difficulty refuse it, so a recalculate difficulty
cannot help.
This hacks around the problem from 526483 until the next hard fork by
adding a grace to the accepted block difficulty - we'll accept a block
from the network if it has 99.8% of the calculated difficulty value.
It also defaults --recalculate-difficulty to 1 so that lokid does a full
difficulty rescan at startup. (This seems to only take a second or two
so seems like a good thing to enable by default).
Peer lookup entries were only being done within a quorum, so when we
added interquorum peers to the realy list we didn't find a lookup record
and so only relayed to them if already connected. On mainnet,
particularly with the recent changes that close idle connections faster,
it's not uncommon to have no Q-to-Q' connections at all, which leads to
blink timeouts.
This commit simplifies the code to just look up everyone in the two
quorums (except for ourselves and the SN that relayed it to us) because
updating it to only look up the 7-8 nodes we might need instead of the
full set of ~18 doesn't seem worth the miniscule lookup savings.
Change the blink quorum checksum value on the wire to a positive
uint64_t rather than the 2s complement int64_t encoded value that
bt_value produces by default. Also updates the bt_dict_consumer code
to handle the needed int64_t -> uint64_t conversion if a negative
int64_t (from a previous lokid version) arrives on the wire.
This signature parsing code was bizarrely failing to parse what appears
to be perfectly valid data, but only on one Debian buster system for
unknown reasons, and not reproducible in a small test case with the
exact data it received.
Rewrote it to use on-the-fly data deserialization (which is more
efficient anyway by avoiding heap memory allocation for
deserialization).
* fix segfault when exiting cli wallet due to running poll thread
* fix whitespace
* style
* support for amount of blacklisted stakes in wallets
* bump version number for blacklist entries with amounts
* default initialize ints in key_image_blacklist_entry
* whitespace
LokiMQ's ConnectionID wasn't working properly for routing replies to
incoming connections from non-service nodes; I already noticed and fixed
this in the lokimq update in the LMQ RPC overhaul branch, but we need to
bring it back into master.
This also changes the SN selection for blink submissions so that we
always prefer submitting to higher version service nodes (and then
randomize among SNs with the same version). This should make blinks
work robustly again: as long as the daemon the wallet talks to and at
least *one* of the 20 quorum members is upgraded we should get a reply
properly.
Wait for thread to end before terminating wallet_rpc
- In RPC wallet, we need to track long polling shutting down separately
from the wallet as the RPC wallet can start up without instantiating
a wallet2 instance. If this is the case, shutting down the RPC wallet
will hang the long polling thread as the terminating variable can never
be retrieved from wallet2.
- Simplify RAII of the long polling thread by putting it into the
simple_wallet destructor
- Fix long poll thread constantly resetting the host. set_server() was
currently parsing host = "localhost:38157" such that get_host()
= "localhost" and port() = 38157 so that host != get_host().
With the 1.1.0 update, rather than LokiMQ getting a callback that it
invokes on connection to get auth level for the duration of that
connection, it now checks authentication each time a command is invoked.
This improves message reliability (because on an invocation failure the
remote doesn't have to reconnect to be reauthenticated).
This helps storage server greatly (which has some tricky initialization
issue that requires it to initialize lokimq before it has the SN list);
it is less needed for quorumnet communications (which have been all
using connection-time authenciation for a while now), but this change
does some one "weirdness" that a remote client may be unable to issue a
command that they *can* issue if they reconnect.
The lokid update here piggypacks the call into quorumnet in quorum_cop's
`add_block` callback to make the call; this would be far cleaner if we
replaced the callbacks with stateful std::function's instead of
inherited base class pointers, but I didn't want to go that far in this
PR.