Skip to content

Commit d5c5a26

Browse files
authored
fix: make llmq_test_instantsend great again (#5832)
## Issue being fixed or feature implemented Running 3 nodes on RegTest as platform does uses do not let to create `llmq_test_instantsend` quorum: ``` 1. switch to `llmq_test_instantsend`: + self.extra_args = [["-llmqtestinstantsenddip0024=llmq_test_instantsend"]] * 5 2. removed cycle-quorum related code: - self.move_to_next_cycle() - self.log.info("Cycle H height:" + str(self.nodes[0].getblockcount())) - self.move_to_next_cycle() - self.log.info("Cycle H+C height:" + str(self.nodes[0].getblockcount())) - self.move_to_next_cycle() - self.log.info("Cycle H+2C height:" + str(self.nodes[0].getblockcount())) - - self.mine_cycle_quorum(llmq_type_name='llmq_test_dip0024', llmq_type=103) 3. added new quorum: + self.mine_quorum(llmq_type_name='llmq_test_instantsend', llmq_type=104) and eventually it stucked, no quorum happens 2024-01-13T19:18:49.317000Z TestFramework (INFO): Expected quorum_0 at:984 2024-01-13T19:18:49.317000Z TestFramework (INFO): Expected quorum_0 hash:6788e18f0235a5c85f3d3c6233fe132a80e74a2912256db3ad876a8ebf026048 2024-01-13T19:18:49.317000Z TestFramework (INFO): quorumIndex 0: Waiting for phase 1 (init) <frozen> ``` ## What was done? Updated condition to enable "llmq_test_instantsend": - it is RegTest and DIP0024 is not active - it is RegTest, DIP0024 is active, and specified as `llmqTypeDIP0024InstantSend` ## How Has This Been Tested? Run unit and functional tests. Beside that functional test feature_asset_locks.py now uses this quorum for instant send and that's an arrow that hit 2 birds: we have test for command line option `-llmqtestinstantsenddip0024` and code of feature_asset_locks.py is simplified. ## Breaking Changes yes, that's a bugfix that fix quorum `llmq_test_instantsend` absentance on regtest after dip-0024 activation. ## Checklist: - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_
1 parent 7b9623f commit d5c5a26

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

src/llmq/options.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,13 @@ bool IsQuorumTypeEnabledInternal(Consensus::LLMQType llmqType, gsl::not_null<con
131131
return true;
132132
case Consensus::LLMQType::LLMQ_50_60:
133133
if (Params().NetworkIDString() == CBaseChainParams::TESTNET) return true;
134-
// fall through
135-
case Consensus::LLMQType::LLMQ_TEST_INSTANTSEND:
136134
return !fDIP0024IsActive;
137135

136+
case Consensus::LLMQType::LLMQ_TEST_INSTANTSEND:
137+
if (!fDIP0024IsActive) return true;
138+
139+
return consensusParams.llmqTypeDIP0024InstantSend == Consensus::LLMQType::LLMQ_TEST_INSTANTSEND;
140+
138141
case Consensus::LLMQType::LLMQ_TEST:
139142
case Consensus::LLMQType::LLMQ_TEST_PLATFORM:
140143
case Consensus::LLMQType::LLMQ_400_60:

test/functional/feature_asset_locks.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
class AssetLocksTest(DashTestFramework):
5353
def set_test_params(self):
54-
self.set_dash_test_params(6, 4, evo_count=3)
54+
self.set_dash_test_params(5, 3, [["-whitelist=127.0.0.1", "-llmqtestinstantsenddip0024=llmq_test_instantsend"]] * 5, evo_count=3)
5555

5656
def skip_test_if_missing_module(self):
5757
self.skip_if_no_wallet()
@@ -241,21 +241,10 @@ def run_test(self):
241241
self.activate_v19(expected_activation_height=900)
242242
self.log.info("Activated v19 at height:" + str(node.getblockcount()))
243243

244-
# TODO: need to refactor this part to common code
245-
# enabling instantsend -> 3 rotating quorums -> new 103 quorum
246-
# with following dynamically adding evo nodes one-by-one seems
247-
# as little too much complex for functional test (each which use Evo nodes)
248244
self.nodes[0].sporkupdate("SPORK_2_INSTANTSEND_ENABLED", 0)
249245
self.wait_for_sporks_same()
250246

251-
self.move_to_next_cycle()
252-
self.log.info("Cycle H height:" + str(self.nodes[0].getblockcount()))
253-
self.move_to_next_cycle()
254-
self.log.info("Cycle H+C height:" + str(self.nodes[0].getblockcount()))
255-
self.move_to_next_cycle()
256-
self.log.info("Cycle H+2C height:" + str(self.nodes[0].getblockcount()))
257-
258-
self.mine_cycle_quorum(llmq_type_name='llmq_test_dip0024', llmq_type=103)
247+
self.mine_quorum(llmq_type_name='llmq_test_instantsend', llmq_type=104)
259248

260249
for i in range(3):
261250
self.dynamically_add_masternode(evo=True)

0 commit comments

Comments
 (0)