This fixes a bug in ScanQuorums which made it return quorums which were not
mined at the time of pindexStart. This was due to quorumHashes being based
on older blocks (the phase=0 block) which are ancestors of pindexStart even
if the commitment was actually mined in a later block.
GetMinedAndActiveCommitmentsUntilBlock is also going to be used for quorum
commitment merkle roots in CCbTx.
This also removes GetFirstMinedQuorumHash as it's not needed anymore.
This iterator allows merged iteration of the key/values from the parent and
the not-yet-committed key/values from the transaction. This also works for
nested transactions (as used in CEvoDB).
It's interface mimics CDBIterator.
...instead of comparing by using the keys < operator.
There are 2 reasons for this:
1. This better mimics the behavior of CDBWrapper. Otherwise there is
a chance of discrepancy when it comes to key equality.
2. Next commit will introduce CDBTransactionIterator, which relies on
CDBTransaction and CDBWrapper being compatible in the way keys are
compared.
We'll later need this method to calculate merkle roots outside of CBlock.
I'd like to avoid moving this code outside of CBlock as it might later
conflict with Bitcoin backports.
Even if its a TX type which we don't want in merkle blocks. Wrongfully
omitting the pushes causes invalid partial merkle trees, which in turn
causes SPV nodes to ban us.
* Update immer library to current master (0a718d2d76bab6ebdcf43de943bd6c7d2dbfe2f9)
* Temporary fix for alignof(std::max_align_t) on MinGW 32bit builds
See https://github.com/arximboldi/immer/issues/78
* Keep the most recent gobject vote only
We don't need to store full vote data for old votes - we never relay them to other nodes anyway.
Still keep old hashes to avoid re-requesting data etc.
* add comment
* Drop getvotes rpc
* Compare vote signals, do not compare hashes
Also add comments
On testnet it's quite usual to have multiple MNs on the same IP. Now that
we have LLMQs and DKGs which require deterministic intra quorum connections,
we must allow them to connect to each other even if the IPs are shared very
often.
* Drop all kind of invalid votes from all types of gobjects
Currently we only do so for proposal "funding" votes which looks incomplete.
* Apply review suggestions
* Fix potential deadlock in LoadWallet()
```
POTENTIAL DEADLOCK DETECTED
Previous lock order was:
(1) cs_main wallet/wallet.cpp:3881
(2) cs_wallet wallet/wallet.cpp:3881
Current lock order is:
(2) pwallet->cs_wallet wallet/walletdb.cpp:589
(1) cs_main wallet/wallet.cpp:1252
```
* Add comment in CWallet::MarkConflicted re new cs_main lock in CWalletDB::LoadWallet()
* Reset local/static cache in LogAcceptCategory when categories change
Without this, it is always required to first set debug to 0, wait a few
seconds (until LogAcceptCategory is called by all affected threads) and
then call "debug somecategory". Otherwise "ptrCategory" never gets updated.
This PR also stores a cache counter locally and globally and updates
"ptrCategory" when the counters do not match.
* Lock cs_args in LogAcceptCategory
* Prepare Dash-related stuff before starting ThreadImport
* Ensure activeMasternodeManager is not null in ThreadImport when DIP3 is active and we are running in masternode mode
* Pass CNode* to IsMasternodeQuorumNode and let it also check verifiedProRegTxHash
This makes IsMasternodeQuorumNode return true on incoming peer connections
as well.
* Let GetMasternodeQuorumNodes also take verifiedProRegTxHash into account
This makes it return NodeIds for incoming peer connections as well.
* Remove AddParticipatingNode and the need for it
This was needed in the past when we were unable to identify incoming
connections from other quorum members. Now that we have MNAUTH, we can
easily identify all connected members.
* Don't track interestedIn quorums in CSigSharesNodeState anymore
Same as with the previous commit, we're now able to easily identify which
nodes to announce sig shares to.
* Remove unused CConnman::GetMasternodeQuorumAddresses
* Sort evo/* source files in Makefile.am
* Keep track of proRegTxHash in CConnman::masternodeQuorumNodes map
We will later need the proRegTxHash
* Fix serialization of std::tuple with const rvalue elements
Having serialization and deserialization in the same specialized template
results in compilation failures due to the "if(for_read)" branch.
* Implement MNAUTH message
This allows masternodes to authenticate themself.
* Protect fresh incoming connections for a second from eviction
Give fresh connections some time to do the VERSION/VERACK handshake and
an optional MNAUTH when it's a masternode. When an MNAUTH happened, the
incoming connection is then forever protected against eviction.
If a timeout of 1 second occurs or the first message after VERACK is not
MNAUTH, the node is not protected anymore and becomes eligable for
eviction.
* Avoid connecting to masternodes if an incoming connection is from the same one
Now that incoming connections from MNs authenticate them self, we can avoid
connecting to the same MNs through intra-quorum connections.
* Apply review suggestions