Commit graph

10588 commits

Author SHA1 Message Date
Jason Rhinelander
65487a9427 Update LokiMQ with bsd build fix 2020-07-06 12:16:19 -03:00
Jason Rhinelander
53002c8adf Add missing deps to freebsd one-liner 2020-07-06 12:15:58 -03:00
Doyle
a8a52647f0
Merge pull request #1163 from jagerman/xenial-boost-fixes
Xenial/boost-1.73 fixes
2020-06-02 15:07:04 +10:00
Jason Rhinelander
7cdc5e5c5e Add another missing boost::placeholders 2020-05-29 01:12:04 -03:00
Jason Rhinelander
0b45cd9e8b LNS: avoid segfault during destruction in unit_tests
A segfault happens here in at least one of the unit tests because the
name_system_db destructor is called without `db` having been set.
2020-05-27 15:06:06 -03:00
Jason Rhinelander
bb59db3f42 Work around gcc-5 internal compiler error
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.
2020-05-27 15:06:06 -03:00
Jason Rhinelander
e2ef747a15 Make false positive logical-op warning non-fatal
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.
2020-05-27 15:06:06 -03:00
Jason Rhinelander
ec60ce34f0 Boost 1.73 compatibility fixes
- 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.
2020-05-27 15:06:06 -03:00
Doyle
c7ed119b8e
LNS: Commit the transaction on exit, don't ignore (#1154) 2020-05-18 10:08:43 +10:00
Doyle
ed35bb5418
recalculate_difficulty: Batch work, avoid LMDB paging error (#1150)
* 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
2020-05-15 14:16:32 +10:00
Doyle
8782f57766
Merge pull request #1152 from Doy-lee/LNSCommitConservatively
LNS: Commit to db more conservatively instead of every block
2020-05-15 13:26:43 +10:00
Doyle
a57c75cc76 LNS: Respect read-only flag 2020-05-15 11:11:59 +10:00
Doyle
d93289126c LNS: Switch to WAL mode + synchronous 2020-05-15 10:55:27 +10:00
Doyle
3be43ea573 LNS: Commit to db more conservatively instead of every block
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.
2020-05-14 16:54:02 +10:00
Jason Rhinelander
2059b46bac Fix signed-unsigned warning 2020-05-05 16:34:18 -03:00
Jason Rhinelander
397229f83b
Merge pull request #1147 from jagerman/recalc-diff-default
Fix --recalculate-difficulty to be default-enableable
2020-05-05 14:38:02 -03:00
Jason Rhinelander
c3a45d6391 Fix --recalculate-difficulty to be default-enablable
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.
2020-05-05 14:30:50 -03:00
Jason Rhinelander
8d3446f141
Merge pull request #1146 from jagerman/difficulty-hack
Hot fix for 526484 stuck nodes
2020-05-05 14:22:14 -03:00
Jason Rhinelander
7c458fe71d 7.1.9 hot fix with block 526484 sync fix 2020-05-05 14:09:20 -03:00
Jason Rhinelander
b017aae3f5 Add grace to required difficulty - fix 526484
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).
2020-05-05 14:09:20 -03:00
Doyle
8f6ecf4c2c
Merge pull request #1143 from jagerman/iqr-fix
Blink inter-quorum relay fixes
2020-05-04 11:24:20 +10:00
Jason Rhinelander
d1d4f85c77 Bump version to 7.1.8 2020-05-03 15:02:19 -03:00
Jason Rhinelander
926a2000e7 Simplify and fix peer lookups
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.
2020-04-30 20:55:02 -03:00
Jason Rhinelander
62c77fe4c7 Deal with negative integer encodings
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.
2020-04-30 15:13:45 -03:00
Jason Rhinelander
fb6e4659fd Make blink signature parsing single-pass
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).
2020-04-29 22:35:51 -03:00
Jason Rhinelander
a5fef804e4 Minor style changes 2020-04-29 22:35:51 -03:00
Jason Rhinelander
fe8cc2aa9f Improve inter-quorum relay trace debugging 2020-04-29 22:35:38 -03:00
Jason Rhinelander
492627ae29 Fix inter-quorum relay
Blink signatures were not being relayed properly from the Q quorum to
the Q' quorum, and so Q' might never learn about the blink.
2020-04-29 15:04:35 -03:00
cryptonote.social
74ca8566d3
show amount for blacklisted stakes (#1140)
* 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
2020-04-29 10:45:44 +10:00
Jason Rhinelander
3874e7478e
Fix blink submission replies (#1142)
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.
2020-04-29 10:34:32 +10:00
Doyle
ba7faacab9
Handle long poll shutdown properly (#1136)
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().
2020-04-22 16:50:08 +10:00
Doyle
1fb87c768c
Bump version 7.1 patch to 6 (#1135) 2020-04-22 10:58:53 +10:00
Doyle
aeead719e7
Update LokiMQ to 1.1.2 (#1134) 2020-04-22 10:24:08 +10:00
Doyle
dabc9fae23
Use std::atomic for mingw build+avoid boost (#1131) 2020-04-20 13:12:21 +10:00
Doyle
fe4b992f5a
Bump version 7.1 patch to 5 (#1130) 2020-04-20 11:57:13 +10:00
Doyle
b9c30f4d0c
LongPoll: Reduce connection timeout duration on local addresses (#1129) 2020-04-20 11:55:27 +10:00
cryptonote.social
c12dcfa93c
fix segfault when exiting cli wallet due to running long poll thread (#1127)
* fix segfault when exiting cli wallet due to running poll thread

* fix whitespace

* style
2020-04-20 11:51:39 +10:00
Doyle
87f0b57b38
Update LokiMQ to v1.1.1 (#1128) 2020-04-20 09:36:14 +10:00
Doyle
f33e426b6b
Update version 7.1 patch to 4 (#1125) 2020-04-16 11:20:28 +10:00
Doyle
29fc6286fc
Merge pull request #1118 from Doy-lee/EpeeCleanup2
Fixes rvalues not taking correct default_serialize overload
2020-04-16 11:20:14 +10:00
Doyle
e0fa701696
get_service_node_status: Handle when SN but not staked (#1124) 2020-04-16 09:43:08 +10:00
Jason Rhinelander
a00be3523b Update to latest lokimq for automatic heartbeating 2020-04-14 20:24:15 -03:00
Jason Rhinelander
5d39a6ae68
Update for LokiMQ 1.1.0's changes (#1122)
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.
2020-04-15 09:22:18 +10:00
Jason Rhinelander
8dc42c1a97
Warn and refuse to submit proofs if we detect duplicate ed/x25519 keys (#1121) 2020-04-14 10:53:40 +10:00
Doyle
b3980dff37 s/varialble/variable typos have a development cost as well 2020-04-09 12:20:39 +10:00
Doyle
5646fa628a Ensure serialize_default prefers default rvalues when deserializing 2020-04-09 12:20:39 +10:00
Doyle
4f1b0786a0
Merge pull request #1109 from loki-project/master
Merge master into dev
2020-04-02 15:31:40 +11:00
Doyle
cb4dde8b0c
Merge pull request #1105 from loki-project/dev
Merge Valiant Vidar 7.1.3 to Master
2020-04-01 11:23:43 +11:00
Doyle
894d82461d
Merge pull request #1108 from jagerman/lns-upgrade-fixes
Fix upgrade, memory leak, abstract sqlite3 interface
2020-04-01 09:26:04 +11:00
Jason Rhinelander
934e398f96 sqlite3_close from name_system_db destructor 2020-03-31 04:13:43 -03:00