Skip to content

Commit

Permalink
fix: add real-time delay 1 second to ensure other quorum validity
Browse files Browse the repository at this point in the history
  • Loading branch information
knst committed Nov 22, 2024
1 parent bb60941 commit 0b3ce03
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/functional/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -1857,6 +1857,12 @@ def mine_quorum(self, llmq_type_name="llmq_test", llmq_type=100, expected_connec
q = self.nodes[0].getbestblockhash()
self.log.info("Expected quorum_hash:"+str(q))
self.log.info("Waiting for phase 1 (init)")
# extra sleep is needed to be sure that we have *all* quorum mined, not only this one
# is is important in case of spork23 is active, because otherwise node can get a ban unexpectable
# that's a silly workaround but it increase stability of functional tests on both localhost and CI
# TODO: replace it to proper validation for each quorum instead just one
if spork23_active:
time.sleep(1)
self.wait_for_quorum_phase(q, 1, expected_members, None, 0, mninfos_online, llmq_type_name=llmq_type_name)
self.wait_for_quorum_connections(q, expected_connections, mninfos_online, wait_proc=lambda: self.bump_mocktime(1), llmq_type_name=llmq_type_name)
if spork23_active:
Expand All @@ -1865,32 +1871,46 @@ def mine_quorum(self, llmq_type_name="llmq_test", llmq_type=100, expected_connec
self.move_blocks(nodes, 2)

self.log.info("Waiting for phase 2 (contribute)")
if spork23_active:
time.sleep(1) # see comment above
self.wait_for_quorum_phase(q, 2, expected_members, "receivedContributions", expected_contributions, mninfos_online, llmq_type_name=llmq_type_name)

self.move_blocks(nodes, 2)

self.log.info("Waiting for phase 3 (complain)")
if spork23_active:
time.sleep(1) # see comment above
self.wait_for_quorum_phase(q, 3, expected_members, "receivedComplaints", expected_complaints, mninfos_online, llmq_type_name=llmq_type_name)

self.move_blocks(nodes, 2)

self.log.info("Waiting for phase 4 (justify)")
if spork23_active:
time.sleep(1) # see comment above
self.wait_for_quorum_phase(q, 4, expected_members, "receivedJustifications", expected_justifications, mninfos_online, llmq_type_name=llmq_type_name)

self.move_blocks(nodes, 2)

self.log.info("Waiting for phase 5 (commit)")
if spork23_active:
time.sleep(1) # see comment above
self.wait_for_quorum_phase(q, 5, expected_members, "receivedPrematureCommitments", expected_commitments, mninfos_online, llmq_type_name=llmq_type_name)

self.move_blocks(nodes, 2)

self.log.info("Waiting for phase 6 (mining)")
if spork23_active:
time.sleep(1) # see comment above
self.wait_for_quorum_phase(q, 6, expected_members, None, 0, mninfos_online, llmq_type_name=llmq_type_name)

self.log.info("Waiting final commitment")
if spork23_active:
time.sleep(1) # see comment above
self.wait_for_quorum_commitment(q, nodes, llmq_type=llmq_type)

self.log.info("Mining final commitment")
if spork23_active:
time.sleep(1) # see comment above
self.bump_mocktime(1)
self.nodes[0].getblocktemplate() # this calls CreateNewBlock
self.generate(self.nodes[0], 1, sync_fun=lambda: self.sync_blocks(nodes))
Expand Down Expand Up @@ -1939,6 +1959,12 @@ def mine_cycle_quorum(self, llmq_type_name="llmq_test_dip0024", llmq_type=103,
self.log.info("Expected quorum_0 at:" + str(self.nodes[0].getblockcount()))
self.log.info("Expected quorum_0 hash:" + str(q_0))
self.log.info("quorumIndex 0: Waiting for phase 1 (init)")
# extra sleep is needed to be sure that we have *all* quorum mined, not only this one
# is is important in case of spork23 is active, because otherwise node can get a ban unexpectable
# that's a silly workaround but it increase stability of functional tests on both localhost and CI
# TODO: replace it to proper validation for each quorum instead just one
if spork23_active:
time.sleep(1)
self.wait_for_quorum_phase(q_0, 1, expected_members, None, 0, mninfos_online, llmq_type_name)
self.log.info("quorumIndex 0: Waiting for quorum connections (init)")
self.wait_for_quorum_connections(q_0, expected_connections, mninfos_online, llmq_type_name, wait_proc=lambda: self.bump_mocktime(1))
Expand All @@ -1951,6 +1977,8 @@ def mine_cycle_quorum(self, llmq_type_name="llmq_test_dip0024", llmq_type=103,
self.log.info("Expected quorum_1 at:" + str(self.nodes[0].getblockcount()))
self.log.info("Expected quorum_1 hash:" + str(q_1))
self.log.info("quorumIndex 1: Waiting for phase 1 (init)")
if spork23_active:
time.sleep(1) # see comment above
self.wait_for_quorum_phase(q_1, 1, expected_members, None, 0, mninfos_online, llmq_type_name)
self.log.info("quorumIndex 1: Waiting for quorum connections (init)")
self.wait_for_quorum_connections(q_1, expected_connections, mninfos_online, llmq_type_name, wait_proc=lambda: self.bump_mocktime(1))
Expand Down

0 comments on commit 0b3ce03

Please sign in to comment.