From aa2f62ca355bab355fe6c43a6675cc43b6940167 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sun, 6 Dec 2020 01:16:51 +0300 Subject: [PATCH 1/6] tests: Enable ChainLocks by default --- test/functional/feature_dip4_coinbasemerkleroots.py | 6 +++++- test/functional/feature_llmq_chainlocks.py | 4 ---- test/functional/feature_llmq_dkgerrors.py | 1 - test/functional/feature_llmq_is_cl_conflicts.py | 2 -- test/functional/feature_llmq_is_retroactive.py | 2 -- test/functional/feature_llmq_simplepose.py | 3 +++ test/functional/interface_zmq_dash.py | 2 -- test/functional/test_framework/test_framework.py | 6 ++++++ 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/test/functional/feature_dip4_coinbasemerkleroots.py b/test/functional/feature_dip4_coinbasemerkleroots.py index 1e99281f67bd..23701ffc9a8f 100755 --- a/test/functional/feature_dip4_coinbasemerkleroots.py +++ b/test/functional/feature_dip4_coinbasemerkleroots.py @@ -37,7 +37,6 @@ def getmnlistdiff(self, baseBlockHash, blockHash): class LLMQCoinbaseCommitmentsTest(DashTestFramework): def set_test_params(self): self.set_dash_test_params(4, 3, fast_dip3_enforcement=True) - self.set_dash_dip8_activation(200) def run_test(self): self.test_node = self.nodes[0].add_p2p_connection(TestP2PConn()) @@ -83,6 +82,9 @@ def run_test(self): self.nodes[0].generate(1) oldhash = self.nodes[0].getbestblockhash() + # Have to disable ChainLocks here because they won't let you to invalidate already locked blocks + self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 4070908800) + self.wait_for_sporks_same() # Test DIP8 activation once with a pre-existing quorum and once without (we don't know in which order it will activate on mainnet) self.test_dip8_quorum_merkle_root_activation(True) for n in self.nodes: @@ -90,6 +92,8 @@ def run_test(self): self.sync_all() first_quorum = self.test_dip8_quorum_merkle_root_activation(False) + # Re-enable ChainLocks again + self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 0) self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() diff --git a/test/functional/feature_llmq_chainlocks.py b/test/functional/feature_llmq_chainlocks.py index 10f1e4a77f1a..311796daa0fd 100755 --- a/test/functional/feature_llmq_chainlocks.py +++ b/test/functional/feature_llmq_chainlocks.py @@ -19,7 +19,6 @@ class LLMQChainLocksTest(DashTestFramework): def set_test_params(self): self.set_dash_test_params(4, 3, fast_dip3_enforcement=True) - self.set_dash_dip8_activation(10) def run_test(self): @@ -43,9 +42,6 @@ def run_test(self): for i in range(4): self.mine_quorum() - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 0) - self.wait_for_sporks_same() - self.log.info("Mine single block, wait for chainlock") self.nodes[0].generate(1) self.wait_for_chainlocked_block_all_nodes(self.nodes[0].getbestblockhash()) diff --git a/test/functional/feature_llmq_dkgerrors.py b/test/functional/feature_llmq_dkgerrors.py index f07b111609a8..b5ddf0ef9737 100755 --- a/test/functional/feature_llmq_dkgerrors.py +++ b/test/functional/feature_llmq_dkgerrors.py @@ -15,7 +15,6 @@ class LLMQDKGErrors(DashTestFramework): def set_test_params(self): self.set_dash_test_params(4, 3, [["-whitelist=127.0.0.1"]] * 4, fast_dip3_enforcement=True) - self.set_dash_dip8_activation(10) def run_test(self): diff --git a/test/functional/feature_llmq_is_cl_conflicts.py b/test/functional/feature_llmq_is_cl_conflicts.py index 4012fb30bc86..92a8434f3815 100755 --- a/test/functional/feature_llmq_is_cl_conflicts.py +++ b/test/functional/feature_llmq_is_cl_conflicts.py @@ -48,7 +48,6 @@ def on_getdata(self, message): class LLMQ_IS_CL_Conflicts(DashTestFramework): def set_test_params(self): self.set_dash_test_params(4, 3, fast_dip3_enforcement=True) - self.set_dash_dip8_activation(10) #disable_mocktime() def run_test(self): @@ -62,7 +61,6 @@ def run_test(self): self.nodes[0].p2p.wait_for_verack() self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 0) self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) self.nodes[0].spork("SPORK_3_INSTANTSEND_BLOCK_FILTERING", 0) self.wait_for_sporks_same() diff --git a/test/functional/feature_llmq_is_retroactive.py b/test/functional/feature_llmq_is_retroactive.py index 2c745acf607c..ce7375da7933 100755 --- a/test/functional/feature_llmq_is_retroactive.py +++ b/test/functional/feature_llmq_is_retroactive.py @@ -22,7 +22,6 @@ def set_test_params(self): # -whitelist is needed to avoid the trickling logic on node0 self.set_dash_test_params(6, 5, [["-whitelist=127.0.0.1"], [], [], [], ["-minrelaytxfee=0.001"], ["-minrelaytxfee=0.001"]], fast_dip3_enforcement=True) self.set_dash_llmq_test_params(5, 3) - self.set_dash_dip8_activation(10) def run_test(self): while self.nodes[0].getblockchaininfo()["bip9_softforks"]["dip0008"]["status"] != "active": @@ -30,7 +29,6 @@ def run_test(self): self.sync_blocks(self.nodes, timeout=60*5) self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 0) self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) self.nodes[0].spork("SPORK_3_INSTANTSEND_BLOCK_FILTERING", 0) self.wait_for_sporks_same() diff --git a/test/functional/feature_llmq_simplepose.py b/test/functional/feature_llmq_simplepose.py index b9a5529d466b..b8d986ee6758 100755 --- a/test/functional/feature_llmq_simplepose.py +++ b/test/functional/feature_llmq_simplepose.py @@ -23,6 +23,9 @@ def set_test_params(self): def run_test(self): self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) + # Have to disable ChainLocks for this test because we have too many + # failing masternodes here and quorums will fail to sign blocks. + self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 4070908800) self.wait_for_sporks_same() # check if mining quorums with all nodes being online succeeds without punishment/banning diff --git a/test/functional/interface_zmq_dash.py b/test/functional/interface_zmq_dash.py index 320e678f51b1..41795b3338fc 100755 --- a/test/functional/interface_zmq_dash.py +++ b/test/functional/interface_zmq_dash.py @@ -45,7 +45,6 @@ def set_test_params(self): node0_extra_args.append("-whitelist=127.0.0.1") self.set_dash_test_params(4, 3, fast_dip3_enforcement=True, extra_args=[node0_extra_args, [], [], []]) - self.set_dash_dip8_activation(10) def run_test(self): # Check that dashd has been built with ZMQ enabled. @@ -67,7 +66,6 @@ def run_test(self): self.sync_blocks() self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 0) self.wait_for_sporks_same() # Create an LLMQ for testing self.quorum_type = 100 # llmq_test diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 0220d80e4586..0e4157b411fc 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -526,6 +526,9 @@ def set_dash_test_params(self, num_nodes, masterodes_count, extra_args=None, fas for i in range(0, num_nodes): self.extra_args[i].append("-dip3params=30:50") + # make sure to activate dip8 after prepare_masternodes has finished its job already + self.set_dash_dip8_activation(200) + # LLMQ default test params (no need to pass -llmqtestparams) self.llmq_size = 3 self.llmq_threshold = 2 @@ -696,6 +699,9 @@ def setup_network(self): self.nodes[0].generate(1) # sync nodes self.sync_all() + # Enable ChainLocks by default + self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 0) + self.wait_for_sporks_same() self.bump_mocktime(1) mn_info = self.nodes[0].masternodelist("status") From 6ae8bdcee38eab955691f707645cd0c0fb7653ea Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sun, 19 Jan 2020 01:31:04 +0300 Subject: [PATCH 2/6] Replace SPORK_3_INSTANTSEND_BLOCK_FILTERING with `-rejectconflictingblocks` cmd-line option --- src/init.cpp | 4 +++- src/llmq/quorums_chainlocks.cpp | 4 ++-- src/llmq/quorums_instantsend.cpp | 5 +++++ src/llmq/quorums_instantsend.h | 3 +++ src/spork.cpp | 1 - src/spork.h | 1 - src/validation.cpp | 2 +- test/functional/feature_llmq_chainlocks.py | 1 - test/functional/feature_llmq_is_cl_conflicts.py | 1 - test/functional/feature_llmq_is_retroactive.py | 1 - test/functional/p2p_instantsend.py | 1 - 11 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index f0c7dc09c7c8..53f5effd6439 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -61,8 +61,9 @@ #include #include -#include #include +#include +#include #include #include @@ -617,6 +618,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageGroup(_("InstantSend options:")); strUsage += HelpMessageOpt("-instantsendnotify=", _("Execute command when a wallet InstantSend transaction is successfully locked (%s in cmd is replaced by TxID)")); + strUsage += HelpMessageOpt("-rejectconflictingblocks", strprintf(_("Reject blocks containing txes that conflict with ones locked via InstantSend (default: %u)"), DEFAULT_REJECT_CONFLICTING_BLOCKS)); strUsage += HelpMessageGroup(_("Node relay options:")); diff --git a/src/llmq/quorums_chainlocks.cpp b/src/llmq/quorums_chainlocks.cpp index edbe36e92755..aa8864ac81c9 100644 --- a/src/llmq/quorums_chainlocks.cpp +++ b/src/llmq/quorums_chainlocks.cpp @@ -300,7 +300,7 @@ void CChainLocksHandler::TrySignChainTip() // considered safe when it is islocked or at least known since 10 minutes (from mempool or block). These checks are // performed for the tip (which we try to sign) and the previous 5 blocks. If a ChainLocked block is found on the // way down, we consider all TXs to be safe. - if (IsInstantSendEnabled() && sporkManager.IsSporkActive(SPORK_3_INSTANTSEND_BLOCK_FILTERING)) { + if (IsInstantSendEnabled() && RejectConflictingBlocks()) { auto pindexWalk = pindex; while (pindexWalk) { if (pindex->nHeight - pindexWalk->nHeight > 5) { @@ -459,7 +459,7 @@ CChainLocksHandler::BlockTxs::mapped_type CChainLocksHandler::GetBlockTxs(const bool CChainLocksHandler::IsTxSafeForMining(const uint256& txid) { - if (!sporkManager.IsSporkActive(SPORK_3_INSTANTSEND_BLOCK_FILTERING)) { + if (!RejectConflictingBlocks()) { return true; } if (!IsInstantSendEnabled()) { diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index acd87816ad41..47b567b2f94d 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -1522,4 +1522,9 @@ bool IsInstantSendEnabled() return sporkManager.IsSporkActive(SPORK_2_INSTANTSEND_ENABLED); } +bool RejectConflictingBlocks() +{ + return gArgs.GetBoolArg("-rejectconflictingblocks", DEFAULT_REJECT_CONFLICTING_BLOCKS); +} + } // namespace llmq diff --git a/src/llmq/quorums_instantsend.h b/src/llmq/quorums_instantsend.h index b0dad34ae5a2..5eb8efd3dbd7 100644 --- a/src/llmq/quorums_instantsend.h +++ b/src/llmq/quorums_instantsend.h @@ -14,6 +14,8 @@ #include #include +static const bool DEFAULT_REJECT_CONFLICTING_BLOCKS = true; + namespace llmq { @@ -174,6 +176,7 @@ class CInstantSendManager : public CRecoveredSigsListener extern CInstantSendManager* quorumInstantSendManager; bool IsInstantSendEnabled(); +bool RejectConflictingBlocks(); } // namespace llmq diff --git a/src/spork.cpp b/src/spork.cpp index 9bff991fa761..03ae3fc0223c 100644 --- a/src/spork.cpp +++ b/src/spork.cpp @@ -18,7 +18,6 @@ const std::string CSporkManager::SERIALIZATION_VERSION_STRING = "CSporkManager-V #define MAKE_SPORK_DEF(name, defaultValue) CSporkDef{name, defaultValue, #name} std::vector sporkDefs = { MAKE_SPORK_DEF(SPORK_2_INSTANTSEND_ENABLED, 4070908800ULL), // OFF - MAKE_SPORK_DEF(SPORK_3_INSTANTSEND_BLOCK_FILTERING, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_9_SUPERBLOCKS_ENABLED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_17_QUORUM_DKG_ENABLED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_19_CHAINLOCKS_ENABLED, 4070908800ULL), // OFF diff --git a/src/spork.h b/src/spork.h index 53079e534525..08d7af4048ef 100644 --- a/src/spork.h +++ b/src/spork.h @@ -22,7 +22,6 @@ class CSporkManager; */ enum SporkId : int32_t { SPORK_2_INSTANTSEND_ENABLED = 10001, - SPORK_3_INSTANTSEND_BLOCK_FILTERING = 10002, SPORK_9_SUPERBLOCKS_ENABLED = 10008, SPORK_17_QUORUM_DKG_ENABLED = 10016, SPORK_19_CHAINLOCKS_ENABLED = 10018, diff --git a/src/validation.cpp b/src/validation.cpp index abba6062b119..031445a42d13 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2313,7 +2313,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl // DASH : CHECK TRANSACTIONS FOR INSTANTSEND - if (sporkManager.IsSporkActive(SPORK_3_INSTANTSEND_BLOCK_FILTERING)) { + if (llmq::RejectConflictingBlocks()) { // Require other nodes to comply, send them some data in case they are missing it. for (const auto& tx : block.vtx) { // skip txes that have no inputs diff --git a/test/functional/feature_llmq_chainlocks.py b/test/functional/feature_llmq_chainlocks.py index 311796daa0fd..b0e9d2f17a18 100755 --- a/test/functional/feature_llmq_chainlocks.py +++ b/test/functional/feature_llmq_chainlocks.py @@ -104,7 +104,6 @@ def run_test(self): self.log.info("Enable LLMQ bases InstantSend, which also enables checks for \"safe\" transactions") self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) - self.nodes[0].spork("SPORK_3_INSTANTSEND_BLOCK_FILTERING", 0) self.wait_for_sporks_same() self.log.info("Isolate a node and let it create some transactions which won't get IS locked") diff --git a/test/functional/feature_llmq_is_cl_conflicts.py b/test/functional/feature_llmq_is_cl_conflicts.py index 92a8434f3815..112f096c33d5 100755 --- a/test/functional/feature_llmq_is_cl_conflicts.py +++ b/test/functional/feature_llmq_is_cl_conflicts.py @@ -62,7 +62,6 @@ def run_test(self): self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) - self.nodes[0].spork("SPORK_3_INSTANTSEND_BLOCK_FILTERING", 0) self.wait_for_sporks_same() self.mine_quorum() diff --git a/test/functional/feature_llmq_is_retroactive.py b/test/functional/feature_llmq_is_retroactive.py index ce7375da7933..54d07f953dba 100755 --- a/test/functional/feature_llmq_is_retroactive.py +++ b/test/functional/feature_llmq_is_retroactive.py @@ -30,7 +30,6 @@ def run_test(self): self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) - self.nodes[0].spork("SPORK_3_INSTANTSEND_BLOCK_FILTERING", 0) self.wait_for_sporks_same() self.mine_quorum() diff --git a/test/functional/p2p_instantsend.py b/test/functional/p2p_instantsend.py index 3b45f52eb795..88cadfa2dbd3 100755 --- a/test/functional/p2p_instantsend.py +++ b/test/functional/p2p_instantsend.py @@ -28,7 +28,6 @@ def run_test(self): self.mine_quorum() self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) - self.nodes[0].spork("SPORK_3_INSTANTSEND_BLOCK_FILTERING", 0) self.wait_for_sporks_same() self.test_mempool_doublespend() From 0f02c7e61bd62b9efe606e9b91c808bd6aa9a83f Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sun, 19 Jan 2020 03:40:36 +0300 Subject: [PATCH 3/6] Replace SPORK_2_INSTANTSEND_ENABLED with `-enableinstantsend` cmd-line option --- src/init.cpp | 1 + src/llmq/quorums_instantsend.cpp | 2 +- src/llmq/quorums_instantsend.h | 1 + src/spork.cpp | 1 - src/spork.h | 1 - test/functional/feature_llmq_chainlocks.py | 11 ++++------- test/functional/feature_llmq_is_cl_conflicts.py | 1 - test/functional/feature_llmq_is_retroactive.py | 1 - test/functional/feature_multikeysporks.py | 6 ++---- test/functional/feature_sporks.py | 6 ++---- test/functional/interface_zmq_dash.py | 1 - test/functional/p2p_instantsend.py | 3 --- 12 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 53f5effd6439..b2d77e4f4b42 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -618,6 +618,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageGroup(_("InstantSend options:")); strUsage += HelpMessageOpt("-instantsendnotify=", _("Execute command when a wallet InstantSend transaction is successfully locked (%s in cmd is replaced by TxID)")); + strUsage += HelpMessageOpt("-enableinstantsend", strprintf(_("Enable use of InstantSend (default: %u)"), DEFAULT_ENABLE_INSTANTSEND)); strUsage += HelpMessageOpt("-rejectconflictingblocks", strprintf(_("Reject blocks containing txes that conflict with ones locked via InstantSend (default: %u)"), DEFAULT_REJECT_CONFLICTING_BLOCKS)); diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index 47b567b2f94d..0ed022d516b5 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -1519,7 +1519,7 @@ void CInstantSendManager::WorkThreadMain() bool IsInstantSendEnabled() { - return sporkManager.IsSporkActive(SPORK_2_INSTANTSEND_ENABLED); + return gArgs.GetBoolArg("-enableinstantsend", DEFAULT_ENABLE_INSTANTSEND); } bool RejectConflictingBlocks() diff --git a/src/llmq/quorums_instantsend.h b/src/llmq/quorums_instantsend.h index 5eb8efd3dbd7..42af72e9bb16 100644 --- a/src/llmq/quorums_instantsend.h +++ b/src/llmq/quorums_instantsend.h @@ -14,6 +14,7 @@ #include #include +static const bool DEFAULT_ENABLE_INSTANTSEND = true; static const bool DEFAULT_REJECT_CONFLICTING_BLOCKS = true; namespace llmq diff --git a/src/spork.cpp b/src/spork.cpp index 03ae3fc0223c..5d7f1d14abbb 100644 --- a/src/spork.cpp +++ b/src/spork.cpp @@ -17,7 +17,6 @@ const std::string CSporkManager::SERIALIZATION_VERSION_STRING = "CSporkManager-V #define MAKE_SPORK_DEF(name, defaultValue) CSporkDef{name, defaultValue, #name} std::vector sporkDefs = { - MAKE_SPORK_DEF(SPORK_2_INSTANTSEND_ENABLED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_9_SUPERBLOCKS_ENABLED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_17_QUORUM_DKG_ENABLED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_19_CHAINLOCKS_ENABLED, 4070908800ULL), // OFF diff --git a/src/spork.h b/src/spork.h index 08d7af4048ef..b21522dc10bb 100644 --- a/src/spork.h +++ b/src/spork.h @@ -21,7 +21,6 @@ class CSporkManager; - This would result in old clients getting confused about which spork is for what */ enum SporkId : int32_t { - SPORK_2_INSTANTSEND_ENABLED = 10001, SPORK_9_SUPERBLOCKS_ENABLED = 10008, SPORK_17_QUORUM_DKG_ENABLED = 10016, SPORK_19_CHAINLOCKS_ENABLED = 10018, diff --git a/test/functional/feature_llmq_chainlocks.py b/test/functional/feature_llmq_chainlocks.py index b0e9d2f17a18..cb646da1ad2e 100755 --- a/test/functional/feature_llmq_chainlocks.py +++ b/test/functional/feature_llmq_chainlocks.py @@ -102,10 +102,6 @@ def run_test(self): self.wait_for_chainlocked_block(self.nodes[0], self.nodes[1].getbestblockhash()) assert(self.nodes[0].getbestblockhash() == self.nodes[1].getbestblockhash()) - self.log.info("Enable LLMQ bases InstantSend, which also enables checks for \"safe\" transactions") - self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) - self.wait_for_sporks_same() - self.log.info("Isolate a node and let it create some transactions which won't get IS locked") isolate_node(self.nodes[0]) txs = [] @@ -119,17 +115,18 @@ def run_test(self): assert("confirmations" not in tx) time.sleep(1) assert(not self.nodes[0].getblock(self.nodes[0].getbestblockhash())["chainlock"]) - self.log.info("Disable LLMQ based InstantSend for a very short time (this never gets propagated to other nodes)") - self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 4070908800) + self.log.info("Restart the node with LLMQ based InstantSend disabled") + self.restart_node(0, self.extra_args[0] + ['-enableinstantsend=0']) self.log.info("Now the TXs should be included") self.nodes[0].generate(1) - self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) self.log.info("Assert that TXs got included now") for txid in txs: tx = self.nodes[0].getrawtransaction(txid, 1) assert("confirmations" in tx and tx["confirmations"] > 0) # Enable network on first node again, which will cause the blocks to propagate and IS locks to happen retroactively # for the mined TXs, which will then allow the network to create a CLSIG + self.log.info("Restart the node with LLMQ based InstantSend enabled") + self.restart_node(0, self.extra_args[0]) self.log.info("Reenable network on first node and wait for chainlock") reconnect_isolated_node(self.nodes[0], 1) self.wait_for_chainlocked_block(self.nodes[0], self.nodes[0].getbestblockhash(), timeout=30) diff --git a/test/functional/feature_llmq_is_cl_conflicts.py b/test/functional/feature_llmq_is_cl_conflicts.py index 112f096c33d5..485decc78763 100755 --- a/test/functional/feature_llmq_is_cl_conflicts.py +++ b/test/functional/feature_llmq_is_cl_conflicts.py @@ -61,7 +61,6 @@ def run_test(self): self.nodes[0].p2p.wait_for_verack() self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) - self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) self.wait_for_sporks_same() self.mine_quorum() diff --git a/test/functional/feature_llmq_is_retroactive.py b/test/functional/feature_llmq_is_retroactive.py index 54d07f953dba..25d595c7d45e 100755 --- a/test/functional/feature_llmq_is_retroactive.py +++ b/test/functional/feature_llmq_is_retroactive.py @@ -29,7 +29,6 @@ def run_test(self): self.sync_blocks(self.nodes, timeout=60*5) self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) - self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) self.wait_for_sporks_same() self.mine_quorum() diff --git a/test/functional/feature_multikeysporks.py b/test/functional/feature_multikeysporks.py index 695c08a007cb..51bffc80b8d3 100755 --- a/test/functional/feature_multikeysporks.py +++ b/test/functional/feature_multikeysporks.py @@ -90,12 +90,10 @@ def setup_network(self): def get_test_spork_value(self, node): info = node.spork('show') - # use InstantSend spork for tests - return info['SPORK_2_INSTANTSEND_ENABLED'] + return info['SPORK_17_QUORUM_DKG_ENABLED'] def set_test_spork_value(self, node, value): - # use InstantSend spork for tests - node.spork('SPORK_2_INSTANTSEND_ENABLED', value) + node.spork('SPORK_17_QUORUM_DKG_ENABLED', value) def run_test(self): # check test spork default state diff --git a/test/functional/feature_sporks.py b/test/functional/feature_sporks.py index 13e507c96db1..cadb483af7d1 100755 --- a/test/functional/feature_sporks.py +++ b/test/functional/feature_sporks.py @@ -23,16 +23,14 @@ def setup_network(self): def get_test_spork_state(self, node): info = node.spork('active') - # use InstantSend spork for tests - return info['SPORK_2_INSTANTSEND_ENABLED'] + return info['SPORK_17_QUORUM_DKG_ENABLED'] def set_test_spork_state(self, node, state): if state: value = 0 else: value = 4070908800 - # use InstantSend spork for tests - node.spork('SPORK_2_INSTANTSEND_ENABLED', value) + node.spork('SPORK_17_QUORUM_DKG_ENABLED', value) def run_test(self): spork_default_state = self.get_test_spork_state(self.nodes[0]) diff --git a/test/functional/interface_zmq_dash.py b/test/functional/interface_zmq_dash.py index 41795b3338fc..3daeab2c956b 100755 --- a/test/functional/interface_zmq_dash.py +++ b/test/functional/interface_zmq_dash.py @@ -64,7 +64,6 @@ def run_test(self): while self.nodes[0].getblockchaininfo()["bip9_softforks"]["dip0008"]["status"] != "active": self.nodes[0].generate(10) self.sync_blocks() - self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() # Create an LLMQ for testing diff --git a/test/functional/p2p_instantsend.py b/test/functional/p2p_instantsend.py index 88cadfa2dbd3..28b0bb13e1a2 100755 --- a/test/functional/p2p_instantsend.py +++ b/test/functional/p2p_instantsend.py @@ -27,9 +27,6 @@ def run_test(self): self.wait_for_sporks_same() self.mine_quorum() - self.nodes[0].spork("SPORK_2_INSTANTSEND_ENABLED", 0) - self.wait_for_sporks_same() - self.test_mempool_doublespend() self.test_block_doublespend() From ec6c482a42ace493ed7123f0a3f787edf0ccba42 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Thu, 3 Dec 2020 15:06:57 +0300 Subject: [PATCH 4/6] Replace SPORK_9_SUPERBLOCKS_ENABLED with `-enablesuperblocks` cmd-line option Add `Goverenance options` help group --- src/governance/governance.cpp | 5 +++++ src/governance/governance.h | 4 ++++ src/init.cpp | 4 +++- src/masternode/masternode-payments.cpp | 18 ++++++++---------- src/rpc/mining.cpp | 4 ++-- src/spork.cpp | 1 - src/spork.h | 1 - 7 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/governance/governance.cpp b/src/governance/governance.cpp index 038f33bf5869..43cdc2d46c0f 100644 --- a/src/governance/governance.cpp +++ b/src/governance/governance.cpp @@ -1303,3 +1303,8 @@ void CGovernanceManager::RemoveInvalidVotes() // store current MN list for the next run so that we can determine which keys changed lastMNListForVotingKeys = curMNList; } + +bool AreSuperblocksEnabled() +{ + return gArgs.GetBoolArg("-enablesuperblocks", DEFAULT_ENABLE_SUPERBLOCKS); +} diff --git a/src/governance/governance.h b/src/governance/governance.h index a85d57daa5b8..80e19967ed5d 100644 --- a/src/governance/governance.h +++ b/src/governance/governance.h @@ -40,6 +40,8 @@ typedef std::pair object_info_pair_t; static const int RATE_BUFFER_SIZE = 5; +static const bool DEFAULT_ENABLE_SUPERBLOCKS = true; + class CRateCheckBuffer { private: @@ -432,4 +434,6 @@ class CGovernanceManager }; +bool AreSuperblocksEnabled(); + #endif // BITCOIN_GOVERNANCE_GOVERNANCE_H diff --git a/src/init.cpp b/src/init.cpp index b2d77e4f4b42..4e0741d8ff7b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -586,7 +586,6 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-debug=", strprintf(_("Output debugging information (default: %u, supplying is optional)"), 0) + ". " + _("If is not supplied or if = 1, output all debugging information.") + " " + _(" can be:") + " " + ListLogCategories() + "."); strUsage += HelpMessageOpt("-debugexclude=", strprintf(_("Exclude debugging information for a category. Can be used in conjunction with -debug=1 to output debug logs for all categories except one or more specified categories."))); - strUsage += HelpMessageOpt("-disablegovernance", strprintf(_("Disable governance validation (0-1, default: %u)"), 0)); strUsage += HelpMessageOpt("-help-debug", _("Show all debugging options (usage: --help -help-debug)")); strUsage += HelpMessageOpt("-logips", strprintf(_("Include IP addresses in debug output (default: %u)"), DEFAULT_LOGIPS)); if (showDebug) @@ -621,6 +620,9 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-enableinstantsend", strprintf(_("Enable use of InstantSend (default: %u)"), DEFAULT_ENABLE_INSTANTSEND)); strUsage += HelpMessageOpt("-rejectconflictingblocks", strprintf(_("Reject blocks containing txes that conflict with ones locked via InstantSend (default: %u)"), DEFAULT_REJECT_CONFLICTING_BLOCKS)); + strUsage += HelpMessageGroup(_("Goverenance options:")); + strUsage += HelpMessageOpt("-enablesuperblocks", strprintf(_("Allow Superblocks to be produced at predefined intervals (default: %u)"), DEFAULT_ENABLE_SUPERBLOCKS)); + strUsage += HelpMessageOpt("-disablegovernance", strprintf(_("Disable governance validation (0-1, default: %u)"), 0)); strUsage += HelpMessageGroup(_("Node relay options:")); if (showDebug) { diff --git a/src/masternode/masternode-payments.cpp b/src/masternode/masternode-payments.cpp index e64935e39f11..68de30ec1be0 100644 --- a/src/masternode/masternode-payments.cpp +++ b/src/masternode/masternode-payments.cpp @@ -119,9 +119,8 @@ bool IsBlockValueValid(const CBlock& block, int nBlockHeight, CAmount blockRewar // we are synced and possibly on a superblock now - if (!sporkManager.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED)) { - // should NOT allow superblocks at all, when superblocks are disabled - // revert to block reward limits in this case + if (!AreSuperblocksEnabled()) { + // should NOT allow superblocks at all, revert to block reward limits in this case LogPrint(BCLog::GOBJECT, "%s -- Superblocks are disabled, no superblocks allowed\n", __func__); if(!isBlockRewardValueMet) { strErrorRet = strprintf("coinbase pays too much at height %d (actual=%d vs limit=%d), exceeded block reward, superblocks are disabled", @@ -177,7 +176,7 @@ bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight, CAmount bloc // superblocks started // SEE IF THIS IS A VALID SUPERBLOCK - if(sporkManager.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED)) { + if(AreSuperblocksEnabled()) { if(CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) { if(CSuperblockManager::IsValid(txNew, nBlockHeight, blockReward)) { LogPrint(BCLog::GOBJECT, "%s -- Valid superblock at height %d: %s", __func__, nBlockHeight, txNew.ToString()); /* Continued */ @@ -191,7 +190,7 @@ bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight, CAmount bloc LogPrint(BCLog::GOBJECT, "%s -- No triggered superblock detected at height %d\n", __func__, nBlockHeight); } } else { - // should NOT allow superblocks at all, when superblocks are disabled + // should NOT allow superblocks at all LogPrint(BCLog::GOBJECT, "%s -- Superblocks are disabled, no superblocks allowed\n", __func__); } @@ -207,12 +206,11 @@ bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight, CAmount bloc void FillBlockPayments(CMutableTransaction& txNew, int nBlockHeight, CAmount blockReward, std::vector& voutMasternodePaymentsRet, std::vector& voutSuperblockPaymentsRet) { - // only create superblocks if spork is enabled AND if superblock is actually triggered + // only create superblocks if they are allowed AND if superblock is actually triggered // (height should be validated inside) - if(sporkManager.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED) && - CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) { - LogPrint(BCLog::GOBJECT, "%s -- triggered superblock creation at height %d\n", __func__, nBlockHeight); - CSuperblockManager::GetSuperblockPayments(nBlockHeight, voutSuperblockPaymentsRet); + if(AreSuperblocksEnabled() && CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) { + LogPrint(BCLog::GOBJECT, "%s -- triggered superblock creation at height %d\n", __func__, nBlockHeight); + CSuperblockManager::GetSuperblockPayments(nBlockHeight, voutSuperblockPaymentsRet); } if (!CMasternodePayments::GetMasternodeTxOuts(nBlockHeight, blockReward, voutMasternodePaymentsRet)) { diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 6adced15b0b6..530c265e88fb 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -472,7 +472,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request) mnpayments.GetBlockTxOuts(chainActive.Height() + 1, 0, voutMasternodePayments); // next bock is a superblock and we need governance info to correctly construct it - if (sporkManager.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED) + if (AreSuperblocksEnabled() && !masternodeSync.IsSynced() && CSuperblock::IsValidBlockHeight(chainActive.Height() + 1)) throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Dash Core is syncing with network..."); @@ -704,7 +704,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request) } result.pushKV("superblock", superblockObjArray); result.pushKV("superblocks_started", pindexPrev->nHeight + 1 > consensusParams.nSuperblockStartBlock); - result.pushKV("superblocks_enabled", sporkManager.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED)); + result.pushKV("superblocks_enabled", AreSuperblocksEnabled()); result.pushKV("coinbase_payload", HexStr(pblock->vtx[0]->vExtraPayload)); diff --git a/src/spork.cpp b/src/spork.cpp index 5d7f1d14abbb..c9a6e011ca5c 100644 --- a/src/spork.cpp +++ b/src/spork.cpp @@ -17,7 +17,6 @@ const std::string CSporkManager::SERIALIZATION_VERSION_STRING = "CSporkManager-V #define MAKE_SPORK_DEF(name, defaultValue) CSporkDef{name, defaultValue, #name} std::vector sporkDefs = { - MAKE_SPORK_DEF(SPORK_9_SUPERBLOCKS_ENABLED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_17_QUORUM_DKG_ENABLED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_19_CHAINLOCKS_ENABLED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_21_QUORUM_ALL_CONNECTED, 4070908800ULL), // OFF diff --git a/src/spork.h b/src/spork.h index b21522dc10bb..2f936569b9b9 100644 --- a/src/spork.h +++ b/src/spork.h @@ -21,7 +21,6 @@ class CSporkManager; - This would result in old clients getting confused about which spork is for what */ enum SporkId : int32_t { - SPORK_9_SUPERBLOCKS_ENABLED = 10008, SPORK_17_QUORUM_DKG_ENABLED = 10016, SPORK_19_CHAINLOCKS_ENABLED = 10018, SPORK_21_QUORUM_ALL_CONNECTED = 10020, From 91109067bdd16b8063d604760b6964a4c1ec1c24 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sun, 11 Oct 2020 20:11:25 +0300 Subject: [PATCH 5/6] Introduce AreChainLocksEnabled() Also rename isSporkActive to isEnabled --- src/llmq/quorums_chainlocks.cpp | 17 +++++++++++------ src/llmq/quorums_chainlocks.h | 3 ++- src/llmq/quorums_instantsend.cpp | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/llmq/quorums_chainlocks.cpp b/src/llmq/quorums_chainlocks.cpp index aa8864ac81c9..30006700413c 100644 --- a/src/llmq/quorums_chainlocks.cpp +++ b/src/llmq/quorums_chainlocks.cpp @@ -90,7 +90,7 @@ CChainLockSig CChainLocksHandler::GetBestChainLock() void CChainLocksHandler::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman) { - if (!sporkManager.IsSporkActive(SPORK_19_CHAINLOCKS_ENABLED)) { + if (!AreChainLocksEnabled()) { return; } @@ -230,8 +230,8 @@ void CChainLocksHandler::CheckActiveState() LOCK(cs); bool oldIsEnforced = isEnforced; - isSporkActive = sporkManager.IsSporkActive(SPORK_19_CHAINLOCKS_ENABLED); - isEnforced = (fDIP0008Active && isSporkActive); + isEnabled = AreChainLocksEnabled(); + isEnforced = (fDIP0008Active && isEnabled); if (!oldIsEnforced && isEnforced) { // ChainLocks got activated just recently, but it's possible that it was already running before, leaving @@ -273,7 +273,7 @@ void CChainLocksHandler::TrySignChainTip() { LOCK(cs); - if (!isSporkActive) { + if (!isEnabled) { return; } @@ -469,7 +469,7 @@ bool CChainLocksHandler::IsTxSafeForMining(const uint256& txid) int64_t txAge = 0; { LOCK(cs); - if (!isSporkActive || !isEnforced) { + if (!isEnabled || !isEnforced) { return true; } auto it = txFirstSeenTime.find(txid); @@ -568,7 +568,7 @@ void CChainLocksHandler::HandleNewRecoveredSig(const llmq::CRecoveredSig& recove { LOCK(cs); - if (!isSporkActive) { + if (!isEnabled) { return; } @@ -727,4 +727,9 @@ void CChainLocksHandler::Cleanup() lastCleanupTime = GetTimeMillis(); } +bool AreChainLocksEnabled() +{ + return sporkManager.IsSporkActive(SPORK_19_CHAINLOCKS_ENABLED); +} + } // namespace llmq diff --git a/src/llmq/quorums_chainlocks.h b/src/llmq/quorums_chainlocks.h index a10b3bc414b9..32faa8a37db3 100644 --- a/src/llmq/quorums_chainlocks.h +++ b/src/llmq/quorums_chainlocks.h @@ -57,7 +57,7 @@ class CChainLocksHandler : public CRecoveredSigsListener boost::thread* scheduler_thread; CCriticalSection cs; bool tryLockChainTipScheduled{false}; - bool isSporkActive{false}; + bool isEnabled{false}; bool isEnforced{false}; uint256 bestChainLockHash; @@ -122,6 +122,7 @@ class CChainLocksHandler : public CRecoveredSigsListener extern CChainLocksHandler* chainLocksHandler; +bool AreChainLocksEnabled(); } // namespace llmq diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index 0ed022d516b5..a5435f5c204c 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -1142,7 +1142,7 @@ void CInstantSendManager::UpdatedBlockTip(const CBlockIndex* pindexNew) // TODO remove this after DIP8 has activated bool fDIP0008Active = VersionBitsState(pindexNew->pprev, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0008, versionbitscache) == ThresholdState::ACTIVE; - if (sporkManager.IsSporkActive(SPORK_19_CHAINLOCKS_ENABLED) && fDIP0008Active) { + if (AreChainLocksEnabled() && fDIP0008Active) { // Nothing to do here. We should keep all islocks and let chainlocks handle them. return; } From b6c557a52e289207e6ea0d40103d9c52e97e728d Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sun, 6 Dec 2020 05:17:50 +0300 Subject: [PATCH 6/6] Replace SPORK_19_CHAINLOCKS_ENABLED with `-enablechainlocks` cmd-line option --- src/init.cpp | 4 ++++ src/llmq/quorums_chainlocks.cpp | 2 +- src/llmq/quorums_chainlocks.h | 2 ++ src/spork.cpp | 1 - src/spork.h | 1 - test/functional/feature_dip4_coinbasemerkleroots.py | 9 +++------ test/functional/feature_governance_objects.py | 2 +- test/functional/feature_llmq_simplepose.py | 7 +++---- test/functional/test_framework/test_framework.py | 3 --- 9 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 4e0741d8ff7b..eb0a18319fda 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -62,6 +62,7 @@ #include #include +#include #include #include @@ -615,6 +616,9 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-masternodeblsprivkey=", _("Set the masternode BLS private key and enable the client to act as a masternode")); strUsage += HelpMessageOpt("-platform-user=", _("Set the username for the \"platform user\", a restricted user intended to be used by Dash Platform, to the specified username.")); + strUsage += HelpMessageGroup(_("ChainLocks options:")); + strUsage += HelpMessageOpt("-enablechainlocks", strprintf(_("Enable use of ChainLocks (default: %u)"), DEFAULT_ENABLE_CHAINLOCKS)); + strUsage += HelpMessageGroup(_("InstantSend options:")); strUsage += HelpMessageOpt("-instantsendnotify=", _("Execute command when a wallet InstantSend transaction is successfully locked (%s in cmd is replaced by TxID)")); strUsage += HelpMessageOpt("-enableinstantsend", strprintf(_("Enable use of InstantSend (default: %u)"), DEFAULT_ENABLE_INSTANTSEND)); diff --git a/src/llmq/quorums_chainlocks.cpp b/src/llmq/quorums_chainlocks.cpp index 30006700413c..fbf7a2505594 100644 --- a/src/llmq/quorums_chainlocks.cpp +++ b/src/llmq/quorums_chainlocks.cpp @@ -729,7 +729,7 @@ void CChainLocksHandler::Cleanup() bool AreChainLocksEnabled() { - return sporkManager.IsSporkActive(SPORK_19_CHAINLOCKS_ENABLED); + return gArgs.GetBoolArg("-enablechainlocks", DEFAULT_ENABLE_CHAINLOCKS); } } // namespace llmq diff --git a/src/llmq/quorums_chainlocks.h b/src/llmq/quorums_chainlocks.h index 32faa8a37db3..783b1abdf871 100644 --- a/src/llmq/quorums_chainlocks.h +++ b/src/llmq/quorums_chainlocks.h @@ -19,6 +19,8 @@ class CBlockIndex; class CScheduler; +static const bool DEFAULT_ENABLE_CHAINLOCKS = true; + namespace llmq { diff --git a/src/spork.cpp b/src/spork.cpp index c9a6e011ca5c..fe3693852af1 100644 --- a/src/spork.cpp +++ b/src/spork.cpp @@ -18,7 +18,6 @@ const std::string CSporkManager::SERIALIZATION_VERSION_STRING = "CSporkManager-V #define MAKE_SPORK_DEF(name, defaultValue) CSporkDef{name, defaultValue, #name} std::vector sporkDefs = { MAKE_SPORK_DEF(SPORK_17_QUORUM_DKG_ENABLED, 4070908800ULL), // OFF - MAKE_SPORK_DEF(SPORK_19_CHAINLOCKS_ENABLED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_21_QUORUM_ALL_CONNECTED, 4070908800ULL), // OFF MAKE_SPORK_DEF(SPORK_22_PS_MORE_PARTICIPANTS, 4070908800ULL), // OFF }; diff --git a/src/spork.h b/src/spork.h index 2f936569b9b9..48476fd87242 100644 --- a/src/spork.h +++ b/src/spork.h @@ -22,7 +22,6 @@ class CSporkManager; */ enum SporkId : int32_t { SPORK_17_QUORUM_DKG_ENABLED = 10016, - SPORK_19_CHAINLOCKS_ENABLED = 10018, SPORK_21_QUORUM_ALL_CONNECTED = 10020, SPORK_22_PS_MORE_PARTICIPANTS = 10021, diff --git a/test/functional/feature_dip4_coinbasemerkleroots.py b/test/functional/feature_dip4_coinbasemerkleroots.py index 23701ffc9a8f..8eda65b80e07 100755 --- a/test/functional/feature_dip4_coinbasemerkleroots.py +++ b/test/functional/feature_dip4_coinbasemerkleroots.py @@ -36,7 +36,9 @@ def getmnlistdiff(self, baseBlockHash, blockHash): class LLMQCoinbaseCommitmentsTest(DashTestFramework): def set_test_params(self): - self.set_dash_test_params(4, 3, fast_dip3_enforcement=True) + # Note: Have to disable ChainLocks because they won't let you to invalidate already locked blocks. + # Do this for the whole test to avoid restarting all nodes twice while running it. + self.set_dash_test_params(4, 3, [["-enablechainlocks=0"]] * 4, fast_dip3_enforcement=True) def run_test(self): self.test_node = self.nodes[0].add_p2p_connection(TestP2PConn()) @@ -82,9 +84,6 @@ def run_test(self): self.nodes[0].generate(1) oldhash = self.nodes[0].getbestblockhash() - # Have to disable ChainLocks here because they won't let you to invalidate already locked blocks - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 4070908800) - self.wait_for_sporks_same() # Test DIP8 activation once with a pre-existing quorum and once without (we don't know in which order it will activate on mainnet) self.test_dip8_quorum_merkle_root_activation(True) for n in self.nodes: @@ -92,8 +91,6 @@ def run_test(self): self.sync_all() first_quorum = self.test_dip8_quorum_merkle_root_activation(False) - # Re-enable ChainLocks again - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 0) self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() diff --git a/test/functional/feature_governance_objects.py b/test/functional/feature_governance_objects.py index 2bf4734a5c91..b73765e951c7 100755 --- a/test/functional/feature_governance_objects.py +++ b/test/functional/feature_governance_objects.py @@ -22,7 +22,7 @@ def validate_object(prepared, rpc_prepared): class DashGovernanceTest (DashTestFramework): def set_test_params(self): - self.set_dash_test_params(2, 1) + self.set_dash_test_params(2, 1, fast_dip3_enforcement=True) def prepare_object(self, object_type, parent_hash, creation_time, revision, name, amount): proposal_rev = revision diff --git a/test/functional/feature_llmq_simplepose.py b/test/functional/feature_llmq_simplepose.py index b8d986ee6758..2ead3f655d0f 100755 --- a/test/functional/feature_llmq_simplepose.py +++ b/test/functional/feature_llmq_simplepose.py @@ -17,15 +17,14 @@ class LLMQSimplePoSeTest(DashTestFramework): def set_test_params(self): - self.set_dash_test_params(6, 5, fast_dip3_enforcement=True) + # Note: Have to disable ChainLocks for this test because we have too many + # failing masternodes here and quorums will fail to sign blocks. + self.set_dash_test_params(6, 5, [["-enablechainlocks=0"]] * 6, fast_dip3_enforcement=True) self.set_dash_llmq_test_params(5, 3) def run_test(self): self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) - # Have to disable ChainLocks for this test because we have too many - # failing masternodes here and quorums will fail to sign blocks. - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 4070908800) self.wait_for_sporks_same() # check if mining quorums with all nodes being online succeeds without punishment/banning diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 0e4157b411fc..73cf51d4b0a3 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -699,9 +699,6 @@ def setup_network(self): self.nodes[0].generate(1) # sync nodes self.sync_all() - # Enable ChainLocks by default - self.nodes[0].spork("SPORK_19_CHAINLOCKS_ENABLED", 0) - self.wait_for_sporks_same() self.bump_mocktime(1) mn_info = self.nodes[0].masternodelist("status")