* 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.
Instead of trying to manually figure out params for different quorum/ring sizes, connect to nodes at indexes (i+2^k)%n where k: 0..floor(log2(n-1))-1, n: size of the quorum/ring
* Move llmqChainLocks initialization closer to other LLMQ related assignments
* Use smaller LLMQs for ChainLocks on testnet and devnet
We very often don't have enough MNs on testnet so we should use a smaller
quorum quorum for ChainLocks.
* Implement copy_datadir to allow easy copying of state from one node to another
* Instead of starting with a fresh datadir for MNs, reuse a copy of the faucet
* Start masternodes in parallel instead of waiting for the previous to finish
* Allow specifying of window and threshold with -bip9params
* Implement -dip3activationheight for regtests
* Implement fast DIP3 activation in DashTestFramework
* Speed up activation of DIP3 in dip3-deterministicmns.py
* Update qa/rpc-tests/test_framework/test_framework.py
Co-Authored-By: codablock <ablock84@gmail.com>
* Always assign fast_dip3_activation
* Replace IsDeterministicMNsSporkActive with IsDIP3Active
IsDIP3Active will now use a fixed parameter from consensus params.
Values for DIP0003Height/DIP0003Hash need to be updated when spork15
activates on mainnet.
Also enforce correct block hash on testnet/mainnet for DIP3 activation
block.
* Remove SPORK_15_DETERMINISTIC_MNS_ENABLED
* Replace all uses of IsDeterministicMNsSporkActive with IsDIP3Active
* Remove DIP3 upgrade-path tests and directly start with DIP3 enabled tests
* Make -masternodeprivkey non-mandatory
This code will vanish later.
* 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
* Add LLMQ parameters to consensus params
* Add DIP6 quorum commitment special TX
* Implement CQuorumBlockProcessor which validates and handles commitments
* Add quorum commitments to new blocks
* Propagate QFCOMMITMENT messages to all nodes
* Allow special transactions in blocks which have no inputs/outputs
But only for TRANSACTION_QUORUM_COMMITMENT for now.
* Add quorum commitments to self-crafted blocks in DIP3 tests
* Add simple fork logic for current testnet
This should avoid a fork on the current testnet. It only applies to the
current chain which activated DIP3 at height 264000 and block
00000048e6e71d4bd90e7c456dcb94683ae832fcad13e1760d8283f7e89f332f.
When we revert the chain to retest the DIP3 deployment, this fork logic
can be removed again.
* Use quorumVvecHash instead of quorumHash to make null commitments unique
Implementation of https://github.com/dashpay/dips/pull/31
* Re-add quorum commitments after pruning mempool selected blocks
* Refactor CQuorumBlockProcessor::ProcessBlock to have less nested if/else statements
Also add BEGIN/END markers for temporary code.
* Add comments/documentation to LLMQParams
* Move code which determines if a commitment is required into IsCommitmentRequired
This should make the code easier to read and also removes some duplication.
The also changes the error types that are possible from 3 to 2 now. Instead
of having "bad-qc-already-mined" and "bad-qc-not-mining-phase", there is
only "bad-qc-not-allowed" now.
* Use new parameter from consensus parames for the temporary fork
* Properly initialize confirmedHash in CSimplifiedMNListEntry
* Add consensus params for temporary hard-fork on testnet
This hard-fork is required on testnet as we have to fix a few consensus
bugs in DIP3/DIP4. It will also be required to introduce LLMQ commitments
to testnet.
* Add temporary fork-logic for testnet, which sets confirmedHash to null
...before fork activation. Otherwise we'd invalidate all DIP3 blocks on
testnet.
* Bump nTemporaryTestnetForkHeight to 273000
* Update defaultAssumeValid and nMinimumChainWork for mainnet
* Update defaultAssumeValid and nMinimumChainWork for testnet
* Add checkpoint for mainnet
* Add checkpoint for testnet
* Add BIP9 parameters for DIP3 deployment on testnet
* Remove autoix BIP9 deployment and reuse DIP3 deployment
* Add BIP9CheckMasternodesUpgraded to chain params
This controls if miners should check for upgraded masternodes first before
adding BIP9 bits to the block version. This only makes sense in network
where masternodes are up and running before BIP9 activation, which is not
necessarely the case in regtest and devnet.
Also refactor ComputeBlockVersion to use fCheckMasternodesUpgraded instead
of the inverse fAssumeMasternodeIsUpgraded. It is set to false by default
and only set to true in CreateNewBlock.
* Check for upgraded masternodes for DIP3 activation (only mainnet and testnet)
* Bump PROTOCOL_VERSION and DMN_PROTO_VERSION
We probably have nodes with 70211 already running on testnet.
* Clear devNetParams and mimic behavior of other param types
Mainnet, testnet and regtest params are global and thus zero initialized,
we should mimic the same for devnet params.
Not doing so results in all kinds of issues on devnet.
* Remove unnecessary <string.h> includein chainparamsbase.cpp
* Allow to use low difficulty and higher block rewards for devnet
Configurable through -minimumdifficultyblocks, -highsubsidyblocks and -highsubsidyfactor
* Fix review comments
* Handle review comments
* support set of keys to sign spork
* several addresses support in -sporkkey
* tests for multykey sporks
* command line option -minsporkkeys
* make spork active only after given number of signers
* use signature in spork hash calculation
* test for new and old spork messages interaction
* add multikeyspork.py to integration tests
* change test to have ability to distinguish default spork value
* require min spork keys number to be more than the half of the common spork keys number
* calc current spork value with majority of signers
* set test nodes time in integration test
* extract keyid from signed spork message directly
* change -sporkaddr option syntax to process several addresses
* codestyle fixes
* fix test comments
* codestyle fixes
* simplify CSporkManager::SporkValueIsActive
* Calc signature hash without signature field
* do not restore pubkey ids from cach
* Calc different keyids to check signature because not all sporks can be synced at moment
* codestyle fixes
* Fix CSporkManager::CheckAndRemove to use several keys
* codestyle fixes
* Correct processing of not actual spork6 value with GetSignerKeyID
* add locktransaction rpc call
* Remove special instantsend fee for simple transactions
* Function to check if trx is simple enough to be autolocked
* Automatic lock for all received from peers simple trxes
If we get a new transaction with CInv message and it is "simple" and
is accepted in mempool, we initiate its lock. We don't lock orphan trxes
that accepted in mempool after this trx because they are locked by other
peers.
* Automatically lock simple trxes in wallet
* protocol bump for InstantSend without special fee
* Add function to detect used mempool share
* Mempool threshold for auto IX locks
* Add SPORK_16_INSTANTSEND_AUTOLOCKS spork
* Make autolocks active only when spork SPORK_16_INSTANTSEND_AUTOLOCKS is active
* BIP9 autolocks activation
* revert increasing min peer protocol version for mn rank
* move IsTrxSimple check to CTxLockRequest class
* make MAX_INPUTS_FOR_AUTO_IX private member of CTxLockRequest class
* make AUTO_IX_MEMPOOL_THRESHOLD private member of CInstantSend class
* remove locktransaction RPC call
* tests for automatic IS locks
* fix mempool threshod calculation
* bump mocktime in activate_autoix_bip9
* set node times
* no need to spam the node with gettransaction rpc requests that often
* use `spork active` instead of leaking spork logic into tests
* codestyle fixes
* add test description in comments
* fix typo
* sync test nodes more often during BIP9 activation
* Use 4th bit in BIP9 activation
* Fix comments according codestyle guide
* Call AcceptLockRequest and Vote at the first node creating autoix lock
* fix mempool used memory calculation
* rallback not necessary change in CWallet::CreateTransaction
* test for stopping autolocks for full mempool
* Inject "simple autolockable" txes into txlockrequest logic
* Allow changing budget parameters for regtest
* Lift some limitations for local addresses for masternodes in regtest
Needed to make masternodes works in regtest mode
* Add "masternode check" RPC to force invocation of CheckAndRemove
Useful in integration tests where MN lists must be predictable
* Remove testnet seeds from devnet
* Lift multiple ports restriction on devnet when considering new nodes
Allow to connect to multiple nodes behind the same IP
* Don't skip addresses with non-default port if it matches -port
If the user specified -port, he very likely intends to connect to nodes
with the same port.
* Don't pass false to CAddrMan constructor as it is already the default
* Make if statements easier to read
* Fix transaction/block versions for devnet genesis blocks
56ff71fcec mistakenly increased the coinbase transaction version instead
of the block version. This fixes it.
* Use v1 for coinbase transaction
* Drop custom logic for delaying GETHEADERS
Reverts "Fix duplicate headers download in initial sync (#1589)" and all following fixes
This reverts commit 169afafd50.
* Fix duplicate initial headers sync
* Make sure gobject collateral was mined
`CGovernanceObject::IsCollateralValid()` would still fail for non-mined collateral later trying to check confirmations
* Fix powLimit for mainnet/testnet
That's a legacy thing, slightly rising it to match the actual bit-shifted value has no effect because real values are already lower.
Also clarify values for all networks in comments.
* Check for script addresses in CSuperblock::ParsePaymentSchedule()
Sentinel should already be downvoting such triggers if they would exist, no need to store/relay them.
* Do not process already known valid vote twice in CGovernanceObject::ProcessVote()
This should be handled by `CGovernanceManager::ProcessVote()` but imo it's better to have this at the `CGovernanceObject::ProcessVote()` level as well.
* Make sure CGovernanceObjectVoteFile::AddVote() never adds/updates already known votes
The way `CGovernanceObjectVoteFile::AddVote()` is used (i.e. wrapped in `CGovernanceObjectVoteFile::HasVote()` condition) it's already the case. Hoever nothing would guarantee consistency if it would be used elsewhere without such wrapper, so it's better to have similar check inside.
* Do not even try mnb recovery when -connect is set
`CConnman::ThreadOpenMasternodeConnections()` thread won't even start when `-connect` is set, so no need to ask for recovery, there is nothing that is going to be able to process such request.
* No need for SIGHASH_ANYONECANPAY in PS collateral signature
Collateral is just a normal tx created and signed by each participant individually, there is no need for special sig types.
* Release semMasternodeOutbound in CConnman::Interrupt()
Re-align Dash code with Bitcoin.
* Switch CNetFulfilledRequestManager and CMasternodeMan maps/funcs to CService
This is to make them work correctly on regtest.
We make sure that behaviour on other networks is not affected though.
* Add fAllowMultiplePorts to chainparams
Tweak either we should allow nodes with the same address and multiple ports or not for this specific chain