* Increment mocktime before setting new SPORK_16_INSTANTSEND_AUTOLOCKS value
Otherwise nodes will not update sporks as they use the same timestamps.
* Disable autoix while filling mempool
* Retest autoix and regular ix after clearing mempool
* Speed up autoix-mempool tests by making the max mempool smaller
With this less TXs have to be created to fill up the mempool.
* Change DashTestFramework to use DIP3 MNs
* Don't assert disabled bip9 in p2p-autoinstantsend.py
* 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 an option to use specific address as a source of funds in protx rpc commands
* fix typo "must"
* Always use payoutAddress (or operatorPayoutAddress) as a default if no fundAddress was specified
* make sure we actually selected some inputs
* fundAddress -> feeSourceAddress
* Align help text with new logic
* fix protx_update_service
* fix protx_revoke
* Add fRequireAllInputs to CCoinControl and use it in FundSpecialTx
This avoids adding all inputs even though they are not needed.
* Allow to specify empty operator payout address and simplify fee code in update_service
DIP3 tests were failing to call "protx update_service" as it did not accept
an empty "operatorPayoutAddress".
This also simplifies handling of the feeSourceAddr.
* Specify source for funds and fees in DIP3 tests
* Ensure EvoDB consistency by storing the best block hash
This approach is similar to the one used for chainstate currently.
Ensures that:
- nodes that upgraded after DIP3 has all the data processed correctly (they will crash and require reindex);
- evodb/ is removed when blocks/ is removed (otherwise sync will fail due to duplicate records).
* Implement CEvoDB::VerifyBestBlock/WriteBestBlock and call them from ConnectBlock/DisconnectBlock
* Fix walletbackup.py
* 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.
* 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
* 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.
* 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
* Revert "Restart MNs in DIP3 tests even if collateral has not moved (#2441)"
This reverts commit 153afb9062.
* Reuse old legacy MN key when upgrading to protx
These need to be restarted even in this case as keys are cycled when
upgrade_mn_protx is called. This resulted in invalid IX votes but was not
noticed because only 2 MNs were affected (still 8 of 10 votes succesful)
* Allow to reuse collaterals and addresses in ProRegTx
This also requires to move out the duplication check from CheckService to
the 2 individual ProTx check methods.
* Implement replacement logic for reused collaterals
* Add tests for new replacement logic
* no `-debug` by default (it's too heavy)
* drop useless `sync_masternodes` calls and add a couple where they could be actually usefull
* change autoix-mempool.py test logic:
1. use separate nodes to send test txes
2. sync nodes while filling the mempool
* Remove reference to now removed "protocolVersion"
* Allow to use non-DIP3 collaterals after DIP3 activation
This removes a rule which only made sense when we assumed all collaterals
would remain in DIP3 ProRegTx transactions after DIP3 activation.
As we allow to refer external collaterals now, this rule should vanish as
well.
* Sleep in case block time is ahead of real time
See comment. This was not a problem before as we had enough time passed
between the last block that caused this and the start-alias call.
Now we added another start-alias call which is directly after we generated
many blocks.
* 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.
Specify masternodeblsprivkey which is required in masternode mode now.
This should fix IS test failures which occur because of `Warning: You should specify a masternodeblsprivkey in the configuration. Please see documentation for help.` init error (there are other issues, so auto-IS test are still going to fail).
* Pass CCoinsView reference to special TX handling methods
* Allow referencing other TX outputs for ProRegTx collateral
* Remove "collateralAmount" from "protx register"
* Rename "protx register" to "protx fund_register"
* Remove UpdateSpork15Value from CDeterministicMNManager
Was not used/implemented anymore
* Lock masternode collaterals after chain/DIP3 is fully initialized
Otherwise detection of collaterals does not work.
* Implement new "protx register" RPC which uses existing collaterals
* Remove "masternode info" RPC
It is not consistent with other "masternode" RPCs anymore as it requires
the ProRegTx hash while all other RPCs work with the collateral.
* Load sporks from disk cache before initializing the chain
Otherwise spork15 is not loaded when we check it for the first time.
* Implement "protx info" RPC
* Use "protx info" instead of "masternode info" in DIP3 tests
* Test external collaterals for ProTx
* Handle review comments
* Don't pass CCoinView reference when it's not used
* Revert "Pass CCoinsView reference to special TX handling methods"
This reverts commit 28688724e1.
* Use GetUTXOCoin instead of now removed coinsView
Also remove collateral height check as GetUTXOCoin only returns confirmed
coins.
* Add conflict handling for external collaterals to mempool
* Handle review comments (squashed Github suggestions)
Co-Authored-By: codablock <ablock84@gmail.com>
* Remove nProtocolVersion fields from deterministic masternode lists
This field was part of my initial implementation from DIP3. One of the last
changes of DIP3 was then to remove this field, which I did not bring back
into code yet. This commit removes it now.
We use PROTOCOL_VERSION now in cases were compatibility in the the pre-DIP3
list is needed.
* Add type and mode fields in DIP3 special TXs
These were added to DIP3 but not in-code yet.
* Add DMN_PROTO_VERSION
* Use BLS keys for operator keys
* Add "bls generate" RPC to generate BLS keys
* Use unique_ptr to store blsKeyOperator and blsPubKeyOperator
Needed because the Chia BLS library crashes when keys are created before
the library is initialized, even if keys are not used. This is the case here
as we have static instances here.
* Remove unnecessary CheckSignature calls
This seems to be some garbage I left in by mistake.
* Fixed review comments
* Fix rpc help for operator keys
All keys that are used as examples are random. None of the secret keys
belongs to any of the public keys.
* Use .GetHash() instead of ::SerializeHash() for BLS pubkeys in txmempool.cpp
* Rename mapProTxBlsPubKeys to mapProTxBlsPubKeyHashes
* create base class for dash-specific tests
* use common base class in p2p-autoinstantsend.py
* use common base class in p2p-instantsend.py
* rename check_IX_lock to wait_for_instantlock
* fix issue with trx amounts precision in autoix-mempool.py
* fix issue with trx amounts precision in p2p-autoinstantsend.py
* fix issue with trx amounts precision in p2p-instantsend.py
* Rallback adding empty line
* Rallback adding empty line
* fix CTxLockRequest::GetMinFee()
* Force regular IS txes to include MIN_FEE * n_inputs fee on creation regardless of auto-IS status
* set_autoix_spork_state should bump mocked time
* make sure IS fee matches the expected one
* turn off spork16 and test all types of txes again
* 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
* Remove leftover RBF code from BTC
* remove rbf #include
* remove rbf in rpc-tests
* removes replace-by-fee.py
* remove help text related to rbf
* remove comment text relating to rbf
* remove "-mempoolreplacement" cli option
* Remove (effectively dead) RBF code which would never have been called anyway and some assosiated variables
* since `setConflicts` is always empty, this is dead code
* Since we don't have RBF, don't have to do this check. Also, since `setConflicts` is always empty this is dead code
* removes unneccesary if as it will always be true
* remove unused `set<uint256> setConflicts`
* Removes replacement of conflicting txs, as conflicting txs are never accepted
* removes RBF from `validForFeeEstimation`
* removes (probably) unnecessary lock
* remove replacing part of the AcceptToMemoryPool and AcceptToMemoryPoolWIthTime
* fixes err in ps.cpp, didn't remove arg
* RBF in net_processing.cpp
* remove arg in ps-server.cpp
* removes another arg in PS code
* removes rawtx.c AcceptToMemoryPool arg
* removes arg in txvalidationcache_tests.cpp
* remove extra args
* forgot an arg
* fix typo in 82898b0
* remove unused fEnableReplacement in validation.h
* remove the removal reason REPLACED in txmempool.h
* removed unused variable
* comment typo
* Implement dip3 integration tests
This tests the full upgrade path from legacy MNs to deterministic MNs
* Invoke UpdatedBlockTip signal when invalidateblock RPC is called
Currently, UpdatedBlockTip would only be called if the invalidation resulted
in another chain becoming the longest one. This is inconsistent behavior
and was spotted when running dip3 integration tests.
* CSporkManager class serialization
* Read/write sporks.dat file
* Move mapSporks into CSporkManager and serialize it
* fix GetSporkByHash
* spork tests
* add missed cs lock
* clear mapSporksByHash in CSporkManager::Clear
* use spork active rpc call to hide spork inner logic
* set small pause between rpc calls in cycles