File dash-core-timeout_factor.patch of Package dash-core
From 36244bfee64b788e00318ae25cbfc738b9a3baad Mon Sep 17 00:00:00 2001
From: Oleg Girko <ol@infoserver.lv>
Date: Tue, 23 May 2023 20:12:22 +0100
Subject: [PATCH] Take timeout_factor into account in many tests.
Signed-off-by: Oleg Girko <ol@infoserver.lv>
---
test/functional/test_framework/test_framework.py | 13 +++++++++++++
test/functional/test_framework/test_node.py | 2 +-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index f419f58d0c..48bc693b42 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -1568,6 +1568,7 @@ class DashTestFramework(BitcoinTestFramework):
return ret
def wait_for_tx(self, txid, node, expected=True, timeout=60):
+ timeout = int(timeout * self.options.timeout_factor)
def check_tx():
try:
self.bump_mocktime(1)
@@ -1600,6 +1601,7 @@ class DashTestFramework(BitcoinTestFramework):
return isdlock
def wait_for_instantlock(self, txid, node, expected=True, timeout=60):
+ timeout = int(timeout * self.options.timeout_factor)
def check_instantlock():
self.bump_mocktime(1)
try:
@@ -1610,6 +1612,7 @@ class DashTestFramework(BitcoinTestFramework):
raise AssertionError("waiting unexpectedly succeeded")
def wait_for_chainlocked_block(self, node, block_hash, expected=True, timeout=15):
+ timeout = int(timeout * self.options.timeout_factor)
def check_chainlocked_block():
try:
block = node.getblock(block_hash)
@@ -1624,9 +1627,11 @@ class DashTestFramework(BitcoinTestFramework):
self.wait_for_chainlocked_block(node, block_hash, expected=expected, timeout=timeout)
def wait_for_best_chainlock(self, node, block_hash, timeout=15):
+ timeout = int(timeout * self.options.timeout_factor)
wait_until_helper(lambda: node.getbestchainlock()["blockhash"] == block_hash, timeout=timeout, sleep=0.1)
def wait_for_sporks_same(self, timeout=30):
+ timeout = int(timeout * self.options.timeout_factor)
def check_sporks_same():
self.bump_mocktime(1)
sporks = self.nodes[0].spork('show')
@@ -1634,6 +1639,7 @@ class DashTestFramework(BitcoinTestFramework):
wait_until_helper(check_sporks_same, timeout=timeout, sleep=0.5)
def wait_for_quorum_connections(self, quorum_hash, expected_connections, mninfos, llmq_type_name="llmq_test", timeout = 60, wait_proc=None):
+ timeout = int(timeout * self.options.timeout_factor)
def check_quorum_connections():
def ret():
if wait_proc is not None:
@@ -1673,6 +1679,7 @@ class DashTestFramework(BitcoinTestFramework):
wait_until_helper(check_quorum_connections, timeout=timeout, sleep=1)
def wait_for_masternode_probes(self, quorum_hash, mninfos, timeout = 30, wait_proc=None, llmq_type_name="llmq_test"):
+ timeout = int(timeout * self.options.timeout_factor)
def check_probes():
def ret():
if wait_proc is not None:
@@ -1711,6 +1718,7 @@ class DashTestFramework(BitcoinTestFramework):
wait_until_helper(check_probes, timeout=timeout, sleep=1)
def wait_for_quorum_phase(self, quorum_hash, phase, expected_member_count, check_received_messages, check_received_messages_count, mninfos, llmq_type_name="llmq_test", timeout=30, sleep=0.5):
+ timeout = int(timeout * self.options.timeout_factor)
def check_dkg_session():
member_count = 0
for mn in mninfos:
@@ -1733,6 +1741,7 @@ class DashTestFramework(BitcoinTestFramework):
wait_until_helper(check_dkg_session, timeout=timeout, sleep=sleep)
def wait_for_quorum_commitment(self, quorum_hash, nodes, llmq_type=100, timeout=15):
+ timeout = int(timeout * self.options.timeout_factor)
def check_dkg_comitments():
for node in nodes:
s = node.quorum("dkgstatus")
@@ -1754,6 +1763,7 @@ class DashTestFramework(BitcoinTestFramework):
wait_until_helper(check_dkg_comitments, timeout=timeout, sleep=1)
def wait_for_quorum_list(self, quorum_hash, nodes, timeout=15, sleep=2, llmq_type_name="llmq_test"):
+ timeout = int(timeout * self.options.timeout_factor)
def wait_func():
self.log.info("quorums: " + str(self.nodes[0].quorum("list")))
if quorum_hash in self.nodes[0].quorum("list")[llmq_type_name]:
@@ -1765,6 +1775,7 @@ class DashTestFramework(BitcoinTestFramework):
wait_until_helper(wait_func, timeout=timeout, sleep=sleep)
def wait_for_quorums_list(self, quorum_hash_0, quorum_hash_1, nodes, llmq_type_name="llmq_test", timeout=15, sleep=2):
+ timeout = int(timeout * self.options.timeout_factor)
def wait_func():
self.log.info("h("+str(self.nodes[0].getblockcount())+") quorums: " + str(self.nodes[0].quorum("list")))
if quorum_hash_0 in self.nodes[0].quorum("list")[llmq_type_name]:
@@ -2077,6 +2088,7 @@ class DashTestFramework(BitcoinTestFramework):
def wait_for_quorum_data(self, mns, quorum_type_in, quorum_hash_in, test_secret=True, expect_secret=True,
recover=False, timeout=60):
+ timeout = int(timeout * self.options.timeout_factor)
def test_mns():
valid = 0
if recover:
@@ -2096,6 +2108,7 @@ class DashTestFramework(BitcoinTestFramework):
wait_until_helper(test_mns, timeout=timeout, sleep=0.5)
def wait_for_mnauth(self, node, count, timeout=10):
+ timeout = int(timeout * self.options.timeout_factor)
def test():
pi = node.getpeerinfo()
c = 0
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py
index d92b5bc4a3..129e20a390 100755
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -253,7 +253,7 @@ class TestNode():
if self.version_is_at_least(180000):
# getmempoolinfo.loaded is available since commit
# 71e38b9ebcb78b3a264a4c25c7c4e373317f2a40 (version 0.18.0)
- wait_until_helper(lambda: rpc.getmempoolinfo()['loaded'])
+ wait_until_helper(lambda: rpc.getmempoolinfo()['loaded'], timeout_factor=self.timeout_factor)
# Wait for the node to finish reindex, block import, and
# loading the mempool. Usually importing happens fast or
# even "immediate" when the node is started. However, there
--
2.45.2