Commit Graph

15684 Commits

Author SHA1 Message Date
Alexander Block
3a6cc2cc17 Show "verified via LLMQ based InstantSend" in GUI TX status 2019-03-07 21:14:31 +01:00
Alexander Block
34a8b2997a Disable old IX code when the new system is active 2019-03-07 21:14:31 +01:00
Alexander Block
5ff4db0a05 Downgrade TXLOCKREQUEST to TX when new IX system is active
The new system does not require explicit lock requests, so we downgrade
TXLOCKREQUEST to TX and start propagating it instead of the original.
2019-03-07 21:14:31 +01:00
Alexander Block
1959f3e4a5 Handle incoming TXs by calling CInstantXManager::ProcessTx
This also includes handling of TXs that were previously orphanced
2019-03-07 21:14:31 +01:00
Alexander Block
83dbcc483f Implement CInstantSendManager and related P2P messages 2019-03-07 21:14:31 +01:00
Alexander Block
5bbc122749 Implement PushReconstructedRecoveredSig in CSigningManager
We can reconstruct recovered sigs from other P2P messages to avoid
re-validation of those. We will do this later in InstantSend code.
2019-03-07 21:14:31 +01:00
Alexander Block
2bbac8ff77 Introduce NotifyChainLock signal and invoke it when CLSIGs get processed 2019-03-07 21:14:31 +01:00
UdjinM6
e47af29d41
Fix "chainlock" in WalletTxToJSON (#2748)
* Fix "chainlock" in WalletTxToJSON

* Add `AssertLockHeld(cs_main); // for mapBlockIndex`

* move assert higher
2019-03-07 16:29:37 +03:00
Alexander Block
e21d8d6b95 Fix error message for invalid voting addresses (#2747) 2019-03-07 16:29:24 +03:00
Alexander Block
80891ee6f7 Make -masternodeblsprivkey mandatory when -masternode is given (#2745) 2019-03-06 22:45:53 +03:00
Alexander Block
521d4ae08f Implement 2-stage commit for CEvoDB to avoid inconsistencies after crashes (#2744)
* Let Commit() return void

The boolean return value will loose its meaning in the next commit

* Implement 2-stage commits for CDBTransaction and CScopedDBTransaction

CDBTransaction is changed to allow CDBBatch, CDBWrapper and other
CDBTransactions as parent instead of just CDBWrapper. This in turn allows
to implement multi-staged commits in CEvoDB.

We now have the "current transaction" which is started and ended (commit
or rollback) for each call to Connect-/DisconnectBlock. When the current
transaction is committed, it moves its contents into the "root transaction"
instead of directly writing to CDBWrapper.

CommitRootTransaction() then handles the final commitment to CDBWrapper. It
is called at the same time when the chainstate is flushed to disk, which
guarantees consistency between chainstate and CEvoDB.

* Allow to efficiently move values into parent transactions to avoid copies

When CDBTransaction<CDBTransaction<...>>::Commit() is called, we can avoid
copying values from this transaction to the parent transaction and instead
pass values by rvalue and let the contents be moved.

* Revert "Force FlushStateToDisk on ConnectTip/DisconnectTip while not in IBD (#2560)"

This reverts commit 6dfceaba5a.
2019-03-06 22:45:39 +03:00
UdjinM6
e63cdadc97
Add a button/context menu items to show QR codes for addresses (#2741)
* Add a button/context menu item to show qr codes for addresses in address book

* Add a context menu item to show qr code for addresses in transaction list
2019-03-06 22:45:22 +03:00
UdjinM6
b6177740c2 Add collateraladdress into masternode/protx list rpc output (#2740) 2019-03-06 08:01:03 +01:00
UdjinM6
b5466e20a9 Add "chainlock" field to more rpcs (#2743) 2019-03-06 08:00:47 +01:00
Alexander Block
8dd9349224
Don't be too harsh for invalid CLSIGs (#2742)
The local node might be the bad one actually as it might not have catched
up with the chain. In that case, LLMQs might be different for the sending
and receiving node.
2019-03-06 08:00:21 +01:00
Alexander Block
a34fb6d6f7 Fix banning when local node doesn't have the vvec (#2739)
When ProcessMessageBatchedSigShares returns false, it's interpreted as
if an invalid/malicious message was received, causing a ban. So, we should
return "!ban" instead of just "ban".
2019-03-05 14:04:04 +03:00
Alexander Block
4a495c6b4d
Only include selected TX types into CMerkleBlock (#2737)
It was reported on iOS that CMerkleBlock sometimes included the dummy
quorum commitments introduced with v13, which led to banning of nodes as
these were not supported/expected there.

We should in general only include TXs here that are of interest for SPV
nodes, so we should maintain the list of allowed TX types.
2019-03-04 07:52:14 +01:00
Pasta
0db2d1596a
code review and reset file perms 2019-03-03 20:50:39 -06:00
Alexander Block
f971da8318 Stop g_connman first before deleting it (#2734) 2019-03-01 18:30:30 +03:00
Alexander Block
9eb0ca7040 Ignore sig share inv messages when we don't have the quorum vvec (#2733)
* Ignore sig share inv messages when we don't have the quorum vvec

* Update src/llmq/quorums_signing_shares.cpp

Co-Authored-By: codablock <ablock84@gmail.com>
2019-03-01 18:30:11 +03:00
fish-en
080b59a573 Backport bitcoin#14385: qt: avoid system harfbuzz and bz2 (#2732)
We may eventually want to break out harfbuzz and build it in depends, but
for now just ensure that runtime dependencies don't depend on whether or not
harfbuzz was present on the builder.
2019-03-01 18:29:48 +03:00
Alexander Block
2041186f4d
On timeout, print members proTxHashes from members which did not send a share (#2731)
* On timeout, print members proTxHashes from members which did not send a share

* Move inactive quorums check above timeout checks

This allows to reuse things in the next commit

* Avoid locking cs_main through GetQuorum by using a pre-filled map

* Use find() instead of [] to access quorums map
2019-03-01 08:21:42 +01:00
Alexander Block
ea90296b6d
Actually start the timers for sig share and recSig verification (#2730)
Was wondering why verification was always 0ms...this explains it :)
2019-03-01 08:21:28 +01:00
Alexander Block
5c84cab0f1
Send/Receive multiple messages as part of one P2P message in CSigSharesManager (#2729)
* Return bool in ProcessMessageXXX methods to indicate misbehaviour

* Send/Receive multiple messages as part of one P2P message in CSigSharesManager

Many messages, especially QSIGSHARESINV and QGETSIGSHARES, are very small
by nature (5-14 bytes for a 50 members LLMQ). The message headers are
24 bytes, meaning that we produce a lot of overhead for these small messages.
This sums up quite a bit when thousands of signing sessions are happening
in parallel.

This commit changes all related P2P messages to send a vector of messages
instead of a single message.

* Remove bogus lines

Included these by accident

* Unify handling of BanNode in ProcessMessageXXX methods

* Remove bogus check for fMasternodeMode

* Properly use == instead of misleading >= in SendMessages

* Put "didSend = true" near PushMessage
2019-03-01 08:21:09 +01:00
Alexander Block
d2573c43b6 Only return from wait_for_chainlock when the block is actually processed (#2728)
getblock also returns blocks which are not processed yet or in the middle
of processing.
2019-02-27 20:42:06 +03:00
UdjinM6
5a61f7b16a
Merge pull request #2726 from codablock/pr_llmq_sessionids
Introduce "session announcements" and session IDs used in LLMQ P2P messages
2019-02-27 20:41:45 +03:00
Alexander Block
6ac49da246 Send QSIGSESANN messages when sending first message for a session 2019-02-27 17:34:08 +01:00
Alexander Block
8ce8cb9ca8 Remove MarkXXX methods from CSigSharesNodeState
We're now directly calling the Merge/Set methods on the inventory objects.
2019-02-27 17:33:40 +01:00
Alexander Block
fa25728ca5 Use new sessionId based session management in CSigSharesManager
Stop relying on the information previously found in the CSigSharesInv
and CBatchedSigShares messages and instead use the information found in
the session refereced by the session id.

This also updates a few LogPrintf calls. Previously, CSigSharesInv::ToString
also included the signHash in the returned string, which is not the case
anymore, so we have to add it manually.
2019-02-27 17:33:40 +01:00
Alexander Block
34e3f8eb53 Implement session management based on session ids and announcements 2019-02-27 17:33:40 +01:00
Alexander Block
7372f6f10b Move RebuildSigShare from CBatchedSigShares to CSigSharesManager
Needed as CBatchedSigShares doesn't have the necessary info anymore
2019-02-27 17:33:40 +01:00
Alexander Block
55a6182b10 Introduce QSIGSESANN/CSigSesAnn P2P message 2019-02-27 17:33:40 +01:00
Alexander Block
80375a0b4f Change CSigSharesInv and CBatchedSigShares to be sessionId based 2019-02-27 17:33:40 +01:00
Alexander Block
2249413a7c
Merge pull request #2725 from codablock/pr_llmq_hashmaps
Add more caching to CRecoveredSigsDb and use salted hashing for externally provided keys
2019-02-27 17:32:50 +01:00
Alexander Block
9b4285b1c8 Use salted hashing for keys for unordered maps/sets in LLMQ code
We must watch out to not blindly use externally provided keys in unordered
sets/maps, as attackers might find ways to cause unbalanced hash buckets
causing performance degradation.
2019-02-27 14:41:20 +01:00
Alexander Block
b5462f5246 Implement std::unordered_map/set compatible hasher classes for salted hashes
Allows convenient salted hashing with unordered maps and sets. Useful when
there is a risk of unbalanced hash buckets slowing things down, e.g. when
externally supplied hashes are used as keys into a map.
2019-02-27 14:40:52 +01:00
Alexander Block
c52e8402c0 Remove now obsolete TODO comment above CRecoveredSigsDb 2019-02-27 14:40:52 +01:00
Alexander Block
e83e32b956 Add in-memory cache for CRecoveredSigsDb::HasRecoveredSigForHash 2019-02-27 14:40:52 +01:00
Alexander Block
677c0040cd Add in-memory cache to CQuorumBlockProcessor::HasMinedCommitment 2019-02-27 14:40:52 +01:00
Alexander Block
f305cf77b6 Multiple fixes and optimizations for LLMQs and ChainLocks (#2724)
* Indicate success when signing was unnecessary

* Fix typo in name of LLMQ_400_60

* Move RemoveAskFor call for CLSIGs into ProcessNewChainLock

In case we got INV items for the same CLSIG that we recreated through
HandleNewRecoveredSig, (re-)requesting of the CLSIG from other peers
becomes unnecessary.

* Move Cleanup() call in CChainLocksHandler::UpdatedBlockTip up

We bail out early in a few situations from this method, so that Cleanup()
might not be called while its at the bottom.

* Bail out from CChainLocksHandler::UpdatedBlockTip if we already got the CLSIG

* Call RemoveAskFor when QFCOMMITMENT was received

Otherwise we might end up re-requesting it for a very long time when the
commitment INV was received shortly before it got mined.

* Call RemoveSigSharesForSession when a recovered sig is received

Otherwise we end up with session data in node states lingering around until
a fake "timeout" occurs (can be seen in the logs).

* Better handling of false-positive conflicts in CSigningManager

The old code was emitting a lot of messages in logs as it treated sigs
for exactly the same session as a conflict. This commit fixes this by
looking at the signHash before logging.

Also handle a corner-case where a recovered sig might be deleted between
the HasRecoveredSigForId and GetRecoveredSigById call.

* Don't run into session timeout when sig shares come in slow

Instead of just tracking when the first share was received, we now also
track when the last (non-duplicate) share was received. Sessios will now
timeout 5 minutes after the first share arrives, or 1 minute after the last
one arrived.
2019-02-27 16:10:12 +03:00
Pasta
c3eb0c7887 reset file perms 2019-02-26 16:50:25 -06:00
Wladimir J. van der Laan
c17356efcf Merge #9970: Improve readability of segwit.py, smartfees.py
1269b8a Fix logging bug and improve readability of smartfees.py (Suhas Daftuar)
b9f34e8 Improve readability of segwit.py (Suhas Daftuar)

Tree-SHA512: 2c8ff61678c6c407a95a6530e9bd650ae6bb7c9e52f6dd5f256e19253a1358dd1a7aa33a9639fcb07f443e3a21dae71b9f0865c5f1fcaacb2097a3c6766c7eef
2019-02-26 16:41:15 -06:00
Wladimir J. van der Laan
ee6e5654e0 Merge #9505: Prevector Quick Destruct
45a5aaf Only call clear on prevector if it isn't trivially destructible and don't loop in clear (Jeremy Rubin)
aaa02e7 Add prevector destructor benchmark (Jeremy Rubin)

Tree-SHA512: 52bc8163b65b71310252f2d578349d0ddc364a6c23795c5e06e101f5449f04c96cbdca41c0cffb1974b984b8e33006471137d92b8dd4a81a98e922610a94132a
2019-02-26 16:41:13 -06:00
Wladimir J. van der Laan
c4a3cd6a13 Merge #8665: Assert all the things!
4d51e9b Assert ConnectBlock block and pIndex are the same block (NicolasDorier)
972714c pow: GetNextWorkRequired never called with NULL pindexLast (Daniel Cousens)
cc44c8f ContextualCheckBlockHeader should never have pindexPrev to NULL (NicolasDorier)

Tree-SHA512: 7cc568bf9417267c335f21ec3d1505b26e56e5b3d5f4d3dbb555279489800aaa65a3bcd7bc376e274dd102912aec16ddbb18de2e2060b2667b41eb979cd9321e
2019-02-26 16:41:11 -06:00
MarcoFalke
b09e3e080d Merge #9977: QA: getblocktemplate_longpoll.py should always use >0 fee tx
655df06 QA: getblocktemplate_longpoll.py should always use >0 fee tx (Suhas Daftuar)

Tree-SHA512: 016647ba1408f8aaa3fc954835542354d54bf2391c4252c1c505101edbbe1cf8dd6a07060930109d0341f86360b9391dfef439999a93a5bae68fc901dace0b71
2019-02-26 16:41:09 -06:00
Wladimir J. van der Laan
e8df27f8ee Merge #9984: devtools: Make github-merge compute SHA512 from git, instead of worktree
a327e8e devtools: Make github-merge compute SHA512 from git, instead of worktree (Wladimir J. van der Laan)

Tree-SHA512: 22ec7712876be4ab361015a2dd75a09628ec59105ffe3260126f899d8f3ff8666351b65b9a4dfe83f78eb777730442cd0352b155d7f573424f7fc1c4dbc0ddd2
2019-02-26 16:41:07 -06:00
Wladimir J. van der Laan
c55e019bf7 Merge #9940: Fix verify-commits on OSX, update for new bad Tree-SHA512, point travis to different keyservers
df5bae2 Update trusted-sha512-root-commit for new bad tree hash (Matt Corallo)
efc06c2 If GNU sha512sum is missing, try perl shasum in verify-commits (Matt Corallo)
8ed849f Fix travis failing to fetch keys from the sks keyserver pool (Matt Corallo)
fd5e905 Make verify-commits.sh non-recursive (Matt Corallo)

Tree-SHA512: 457cc81d6e0a77ab32d030ecd058c59857f22cb998a1394593e115639081f3fdc74a6376035b77be0712ad5cb9143bc3f498b77e99eb66034492dbbb38c39bc6
2019-02-26 16:41:05 -06:00
Wladimir J. van der Laan
f9a2e4c4fc Merge #9514: release: Windows signing script
09fe2d9 release: update docs to show basic codesigning procedure (Cory Fields)
f642753 release: create a bundle for the new signing script (Cory Fields)
0068361 release: add win detached sig creator and our cert chain (Cory Fields)

Tree-SHA512: 032ad84697c70faaf857b9187f548282722cffca95d658e36413dc048ff02d9183253373254ffcc1158afb71140753f35abfc9fc8781ea5329c04d13c98759c0
2019-02-26 16:41:04 -06:00
Wladimir J. van der Laan
ee2048ae44 Merge #9830: Add safe flag to listunspent result
dcf2112 Add safe flag to listunspent result (NicolasDorier)
af61d9f Add COutput::fSafe member for safe handling of unconfirmed outputs (Russell Yanofsky)

Tree-SHA512: 311edb6fa8075b3ede5b24cb8c6e5d133ccd8ac9ecafea07b604ffa812ee4f071337e31695e662d8573590a0460af20aaaeb39d49c9ea87924449ea50bdfb0b3
2019-02-26 16:41:02 -06:00
MarcoFalke
914bd78770 Merge #9972: Fix extended rpc tests broken by #9768
d055bd6 Fix extended rpc tests broken by 8910b4717e (John Newbery)

Tree-SHA512: 30e019bd7e17013143e419777491ac0efd9760dddac7232d320c9afe80bc2fb383acd331e20cd5b3e21df1177c0e4a5221c99f831e90cf869d3affca206b9728
2019-02-26 16:41:00 -06:00