Skip to content

Commit 9d9975f

Browse files
committed
test: simplify wait_for_quorum_list
Quorums are already generated and mined, all calculations are done. Waiting long (0.5seconds) is not necessary Bumping mocktime and generation new blocks no useful anymore
1 parent fd3f3d4 commit 9d9975f

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

test/functional/test_framework/test_framework.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,26 +1814,19 @@ def check_dkg_comitments():
18141814

18151815
self.wait_until(check_dkg_comitments, timeout=timeout, sleep=1)
18161816

1817-
def wait_for_quorum_list(self, quorum_hash, nodes, timeout=15, sleep=2, llmq_type_name="llmq_test"):
1817+
def wait_for_quorum_list(self, quorum_hash, nodes, timeout=15, llmq_type_name="llmq_test"):
18181818
def wait_func():
1819-
self.log.info("quorums: " + str(self.nodes[0].quorum("list")))
1820-
if quorum_hash in self.nodes[0].quorum("list")[llmq_type_name]:
1821-
return True
1822-
self.bump_mocktime(sleep, nodes=nodes)
1823-
self.generate(self.nodes[0], 1, sync_fun=lambda: self.sync_blocks(nodes))
1824-
return False
1825-
self.wait_until(wait_func, timeout=timeout, sleep=sleep)
1819+
quorums = self.nodes[0].quorum('list')
1820+
self.log.info(f"quorums: {quorums}")
1821+
return quorum_hash in quorums[llmq_type_name]
1822+
self.wait_until(wait_func, timeout=timeout, sleep=0.05)
18261823

1827-
def wait_for_quorums_list(self, quorum_hash_0, quorum_hash_1, nodes, llmq_type_name="llmq_test", timeout=15, sleep=2):
1824+
def wait_for_quorums_list(self, quorum_hash_0, quorum_hash_1, nodes, llmq_type_name="llmq_test", timeout=15):
18281825
def wait_func():
1829-
self.log.info("h("+str(self.nodes[0].getblockcount())+") quorums: " + str(self.nodes[0].quorum("list")))
1830-
if quorum_hash_0 in self.nodes[0].quorum("list")[llmq_type_name]:
1831-
if quorum_hash_1 in self.nodes[0].quorum("list")[llmq_type_name]:
1832-
return True
1833-
self.bump_mocktime(sleep, nodes=nodes)
1834-
self.generate(self.nodes[0], 1, sync_fun=lambda: self.sync_blocks(nodes))
1835-
return False
1836-
self.wait_until(wait_func, timeout=timeout, sleep=sleep)
1826+
quorums = self.nodes[0].quorum("list")
1827+
self.log.info(f"h({self.nodes[0].getblockcount()}) quorums: {quorums}")
1828+
return quorum_hash_0 in quorums[llmq_type_name] and quorum_hash_1 in quorums[llmq_type_name]
1829+
self.wait_until(wait_func, timeout=timeout, sleep=0.05)
18371830

18381831
def move_blocks(self, nodes, num_blocks):
18391832
self.bump_mocktime(1, nodes=nodes)

0 commit comments

Comments
 (0)