Commit Graph

15797 Commits

Author SHA1 Message Date
Alexander Block
43612a2720 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-07 06:56:05 +01:00
Alexander Block
f868fbc787 Stop g_connman first before deleting it (#2734) 2019-03-07 06:56:05 +01:00
Alexander Block
9e233f391d Fix incorrect usage of begin() when genesis block is requested in "protx diff" (#2699)
* Fix incorrect usage of begin() when genesis block is requested in "protx diff"

.begin() on mapBlockIndex does NOT return the genesis block, but just the
block with lowest hash.

The fix is to use chainActive[0] to get the genesis block.

* Update src/evo/simplifiedmns.cpp

Co-Authored-By: codablock <ablock84@gmail.com>
2019-03-07 06:56:05 +01:00
UdjinM6
e75f971b90 Do not process blocks in CDeterministicMNManager before dip3 activation (#2698)
* Do not process blocks in CDeterministicMNManager before dip3 activation

This should save us some cpu/disk on initial sync/reindex

* Write initial snapshot on dip3 activation
2019-03-07 06:56:05 +01:00
PastaPastaPasta
1cc47ebcd0 Backport #14701: build: Add CLIENT_VERSION_BUILD to CFBundleGetInfoString (#2687)
8e209340c85fc2493d7d1d7affe7e316bb613cbd build: Add CLIENT_VERSION_BUILD to CFBundleGetInfoString (fanquake)

Pull request description:

  As mentioned in #14697, if you download the `0.17.0.1` dmg, and inspect the `.app` bundle, the version in the GetInfo string reads `0.17.0`, which is confusing given you're expecting `0.17.0.1`:
  <img width="391" alt="0 17 0 1" src="https://user-images.githubusercontent.com/863730/48300032-fbb54b00-e510-11e8-9bcd-77e1fffffc63.png">

  This PR adds `CLIENT_VERSION_BUILD` to the string, so that the full version number is displayed, i.e:
  <img width="327" alt="this pr" src="https://user-images.githubusercontent.com/863730/48300015-7893f500-e510-11e8-98b9-80424719a082.png">

Tree-SHA512: f553253d03283639cc4dda00c8004b5c63ae2b489762e5e8c666166e71b14e672792c1df678f87484d51d153b5781c5ec1b145774096600f504833024ae8baea
2019-03-07 06:56:05 +01: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
MarcoFalke
dad8c67d38 Merge #9768: [qa] Add logging to test_framework.py
64c0800 Use logging in individual tests (John Newbery)
38ad281 Use logging in test_framework/comptool.py (John Newbery)
ff19073 Use logging in test_framework/blockstore.py (John Newbery)
2a9c7c7 Use logging in test_framework/util.py (John Newbery)
b0dec4a Remove manual debug settings in qa tests. (John Newbery)
af1363c Always enable debug log and microsecond logging for test nodes. (John Newbery)
6d0e325 Use logging in mininode.py (John Newbery)
553a976 Add logging to p2p-segwit.py (John Newbery)
0e6d23d Add logging to test_framework.py (John Newbery)

Tree-SHA512: 42ee2acbf444ec32d796f930f9f6e272da03c75e93d974a126d4ea9b2dbaa77cc57ab5e63ce3fd33d609049d884eb8d9f65272c08922d10f8db69d4a60ad05a3
2019-02-26 15:54:32 -06:00
MarcoFalke
c75d7dc832 Merge #9962: [trivial] Fix typo in rpc/protocol.h
9ea2490 [trival] Fix typo introduced into rpc/protocol.h in commit 338bf06 (practicalswift)

Tree-SHA512: bfa60dc9f40db867b09e60dbe803db79c86ff939048c91e551c0794a91428bde3aa42c4aabf915c640cd15565005608da10dae051942e806fdf5d28e9704d765
2019-02-26 15:26:01 -06:00
Wladimir J. van der Laan
49b743e39a Merge #9538: [util] Remove redundant call to get() on smart pointer (thread_specific_ptr)
53a2ba3 [util] Remove redundant call to get() on smart pointer (thread_specific_ptr) (practicalswift)

Tree-SHA512: ec8ace4218ae0657d1aaf8ba7682b0cdd140fe0844173058d3cbf4575dee8d9ad5f241e5bacf1e9e4ad3f7dd282f56a8cb0f306de2093f2c0f6333daedd58261
2019-02-26 15:25:32 -06:00
Wladimir J. van der Laan
e5c4a67a20 Merge #9916: Fix msvc compiler error C4146 (minus operator applied to unsigned type)
8e0720b Fix msvc compiler error C4146 (unary minus operator applied to unsigned type) (kobake)
292112f Fix msvc compiler error C4146 (minus operator applied to unsigned type) (kobake)

Tree-SHA512: 25f408daf7bf9ffe4b8b4bd62f6f6d326219189a9faf8f8c0a135c5a0cb0511af765aa2b6087a091c8863c701289bda49a2379b00cd9b10854d316a5c3fc3f8e
2019-02-26 15:24:31 -06:00