* Don't delete/add values to the unique property map when it's null
This happens when revoking operator keys, as the revoked MN will then have
the address and operator keys set to the null representation. We shouldn't
add the null value to the unique property map as otherwise future revokes
crash in an assert.
* Assert that no null values are passed to Add/DeleteUniqueProperty
* Check for null values before calling Add/DeleteUniqueProperty
* Apply suggestions from code review
Co-Authored-By: codablock <ablock84@gmail.com>
* Add user generated default constructors to BLS primitives
Fixes build issues on Mac:
In file included from evo/deterministicmns.cpp:5:
./evo/deterministicmns.h:375:24: error: default initialization of an object of const type 'const CBLSPublicKey' without a user-provided default constructor
static const T nullValue;
^
https://github.com/dashpay/dash/pull/2409 removed the need to call the
Init method of the Chia BLS library, but we also accidently removed the
initialization of the secure allocator.
* Implement creation and propagation of dummy contributions
These act as a ping which is broadcast a few blocks before the dummy
commitments are created. They are meant to determine online/offline members.
* Use information about received dummy contributions to determine validMembers
* Fix PoSe tests
* Fix dummy DKG phase progress in PoSe tests and give tests more time
Mine one block at a time until we reach the mining phase.
* Track TXs in mempool which refer to an existing ProTx
* When a block is added, remove TXs that refer to ProTxs with spent collaterals
* Initalize evoDb and deterministicMNManager in BasicTestingSetup
instead of TestingSetup. Now that the mempool uses deterministicMNManager,
we need to initialize it for all tests that might use the mempool.
* Allow skipping of MN payments with zero duffs
In case a MNO uses an operator reward of 100%, the normal reward will be 0
duffs. It doesn't make sense to enforce these payments.
This will cause a fork when miners start to mine with the new version, but
only for nodes that didn't upgrade.
* Apply suggestions from code review
Co-Authored-By: codablock <ablock84@gmail.com>
* Fix spork syncing issue in sporks tests
https://github.com/dashpay/dash/pull/2522 caused an issue with sporks syncing
in tests. The introduced time check in CMasternodeSync::ProcessTick causes
masternode sync to never start when mocktime is enabled, so this commit
disables mocktime for sporks.py.
Disabling mocktime however leads to fInitialDownload never becoming false
in CMasternodeSync::UpdatedBlockTip, so mnsync is never started. To fix
this, the tests now create a block before connecting the last node.
This however doesn't work because node1 will ignore the "getheaders" request
from node2 as it has not finished mnsync yet...so we also have to force
finish mnsync for node1.
* Also respond with getdata for announced sporks while in IBD
There was never a good reason to ignore spork announcements while in IBD.
At the same time, this poses the risk of missing out on sporks while in IBD.
This also fixes an issue in sporks testing, as nodes did not request for
announced sporks.
* Use wait_to_sync instead of custom loop
* Use CountMasternodes() in ClientModel::getMasternodeCountString
* Use CountMasternodes() for total count in masternode_count
* Fix CountMasternodes() to give correct number of masternodes with spork15 enabled
Also change CountEnabled to not call CountMasternodes anymore but instead
have its own implementation which uses GetValidMNsCount instead of GetAllMNsCount
* Apply review suggestions
This is moving up the RemoveAskFor call above the ProcessTxLockRequest
call. If ProcessTxLockRequest fails, we should not re-request the same
TX/IX from other nodes as it will continue to fail.
* Check resulting signature for validity when signing with BLS operator keys
* Support specifying proTxHash when using "gobject vote-alias"
The "alias-name" is now interpreted as proTxHash when deterministic MN lists
are active.
The classical "alias" as found in masternode.conf has no meaning after
spork15 activation.
* Don't use masternode.conf list in gobject_vote_many when spork15 is active
Keys don't match anymore so we should only rely on the deterministic list
and the local wallet's keys.
* Check for pwalletMain not being null in gobject_vote_many
* Allow to use vote-conf for non-proposal votes when spork15 is active
This fixes sentinel not being able to create triggers on testnet.
* Fix error message
* Fix no-wallet compilation and check for pwalletMain at runtime
All logging that happens in BuildNewListFromBlock is currently printed twice.
This is because BuildNewListFromBlock is called while processing the block
and also while calculating the DIP4 MN list commitment.
This commit adds the debugLogs to this method to allow omitting logs while
called from the DIP4 code.
In the future, we should make sure that this method is only called for the
currently mined block or for old blocks, but never for non-existing blocks
further in the future.
Specifically:
```
GUI: QMetaObject::connectSlotsByName: No matching signal for on_extraInfoDIP3_doubleClicked()
GUI: QMetaObject::connectSlotsByName: No matching signal for on_copyProTxHash_clicked()
GUI: QMetaObject::connectSlotsByName: No matching signal for on_copyCollateralOutpoint_clicked()
```
* Move deserialization of REJECT message fields out of if(fDebug)
* Ban nodes which keep requesting and then rejecting blocks
* Don't read/deserialize reject hash twice
* Only use ban score of 1
* Clear votes which were created before spork15 activation
* Reject incoming votes which were created pre-DIP3
* Only use voting keys for VOTE_SIGNAL_FUNDING
The other vote signals are meant to be emitted by sentinel and must thus
be signed with the operator key.
* Simplify GetMinVoteTime
* Review suggestions/fixes
* Add missing mutex in CGovernanceObject::RemoveOldVotes
* Don't fully remove protx commands when ENABLE_WALLET is not set
* Check for wallet support at run-time for protx commands
* Only show subcommands that require the wallet when ENABLE_WALLET is set
* Add and use CheckWalletOwnsKey which is able to check wallet support at runtime
* Properly handle disabled wallets in "protx list"
This now also handles the case where ENABLE_WALLET is not defined.
* Drop comment that doesn't fully apply anymore
* Deserialize CFinalCommitmentTxPayload instead of CFinalCommitment in TxToJSON
* Implement ToJson for CFinalCommitmentTxPayload and use it in TxToJSON
Otherwise the nVersion and nHeight members of it are not shown.
* Let GetMasternodeRank also return the block hash at the given height
* Add outpointConfirmedBlock to CTxLockVote and verify it
* Match order of parameters with member order
* Rename outpointConfirmedBlock to quorumModifierHash
* Add overload of GetMasternodeRank that does not return the block hash
* Allow to skip sig verification for CFinalCommitment::Verify
* Add CFinalCommitmentTxPayload and CheckLLMQCommitment and use it
As described in https://github.com/dashpay/dips/pull/31 (see discussion).
* Properly ban nodes for invalid commitments
* Add SPORK_17_QUORUM_DKG_ENABLED spork
* Implement CDummyDKG and CDummyCommitment until we have the real DKG merged
This is only used on testnet/devnet/regtest and will NEVER be used on
mainnet. It is NOT SECURE AT ALL!
See comment in quorums_dummydkg.h for more details.
* Test simple PoSe in DIP3 tests
* Generate 2 instead of 4 blocks per iteration in PoSe tests
4 was based on old chainparams where I used larger phases.
* Only sleep when necessary in PoSe tests
* Fix typo in comment
* Give PoSe tests more time and sync after fast-forward
* Sleep in wait_for_instant_lock when TX is not known yet
We'll otherwise stress the CPU quite a lot, which might in turn result in
instant send timeouts.
* Wait for all nodes to have the instant send lock
Otherwise individual nodes might end up not being able to catch up,
especially when it's the last iteration and we generate 6 blocks after it.
* Use getrawtransaction in wait_for_instant_lock instead of gettransaction
gettransaction fails if the TX is not owned by the wallet
* Give instant send tests more time after DIP3 activation
Signature verification changes to BLS when DIP3 gets activated, which is
much more resource hungry. Give instant send tests more time after DIP3
activation until we do proper batched verification of instant send
signatures.
* Allow specifing max number of outpoints to be returned per address in SelectCoinsGroupedByAddresses
Fixes CreateDenominated failure for addresses with huge amount of inputs
* Apply suggested fixes
Members which are not in the validMembers bitsets are now PoSe punished.
The maximum PoSe score is dynamic and mostly identical to the number of
registered MNs. Added PoSe scores for failures are then a percentage of
the maximum score, so that we can better control how often failures are
allowed per payment cycle. For LLMQ failures, this is 66% to allow
approximately 2 failures per payment cycle.