diff --git a/qa/rpc-tests/autoix-mempool.py b/qa/rpc-tests/autoix-mempool.py index 77416f89c0780..c3d65926a135e 100755 --- a/qa/rpc-tests/autoix-mempool.py +++ b/qa/rpc-tests/autoix-mempool.py @@ -49,7 +49,7 @@ def activate_autoix_bip9(self): if counter % sync_period == 0: # sync nodes self.sync_all() - sync_masternodes(self.nodes) + sync_masternodes(self.nodes, True) while self.get_autoix_bip9_status() == 'started': set_mocktime(get_mocktime() + 1) @@ -59,7 +59,7 @@ def activate_autoix_bip9(self): if counter % sync_period == 0: # sync nodes self.sync_all() - sync_masternodes(self.nodes) + sync_masternodes(self.nodes, True) while self.get_autoix_bip9_status() == 'locked_in': set_mocktime(get_mocktime() + 1) @@ -69,11 +69,11 @@ def activate_autoix_bip9(self): if counter % sync_period == 0: # sync nodes self.sync_all() - sync_masternodes(self.nodes) + sync_masternodes(self.nodes, True) # sync nodes self.sync_all() - sync_masternodes(self.nodes) + sync_masternodes(self.nodes, True) assert(self.get_autoix_bip9_status() == 'active') diff --git a/qa/rpc-tests/invalidblockrequest.py b/qa/rpc-tests/invalidblockrequest.py index dd581d85153d7..b6f1e4ffe6f09 100755 --- a/qa/rpc-tests/invalidblockrequest.py +++ b/qa/rpc-tests/invalidblockrequest.py @@ -33,7 +33,7 @@ def run_test(self): self.tip = None self.block_time = None NetworkThread().start() # Start up network handling in another thread - sync_masternodes(self.nodes) + sync_masternodes(self.nodes, True) test.run() def get_tests(self): diff --git a/qa/rpc-tests/p2p-autoinstantsend.py b/qa/rpc-tests/p2p-autoinstantsend.py index ddf8cbf770f2b..db2af7ce2862b 100755 --- a/qa/rpc-tests/p2p-autoinstantsend.py +++ b/qa/rpc-tests/p2p-autoinstantsend.py @@ -51,7 +51,7 @@ def activate_autoix_bip9(self): if counter % sync_period == 0: # sync nodes self.sync_all() - sync_masternodes(self.nodes) + sync_masternodes(self.nodes, True) while self.get_autoix_bip9_status() == 'started': set_mocktime(get_mocktime() + 1) @@ -61,7 +61,7 @@ def activate_autoix_bip9(self): if counter % sync_period == 0: # sync nodes self.sync_all() - sync_masternodes(self.nodes) + sync_masternodes(self.nodes, True) while self.get_autoix_bip9_status() == 'locked_in': set_mocktime(get_mocktime() + 1) @@ -71,11 +71,11 @@ def activate_autoix_bip9(self): if counter % sync_period == 0: # sync nodes self.sync_all() - sync_masternodes(self.nodes) + sync_masternodes(self.nodes, True) # sync nodes self.sync_all() - sync_masternodes(self.nodes) + sync_masternodes(self.nodes, True) assert(self.get_autoix_bip9_status() == 'active') diff --git a/qa/rpc-tests/p2p-fullblocktest.py b/qa/rpc-tests/p2p-fullblocktest.py index f2a541b61c98f..ed34563d8ef77 100755 --- a/qa/rpc-tests/p2p-fullblocktest.py +++ b/qa/rpc-tests/p2p-fullblocktest.py @@ -69,7 +69,7 @@ def run_test(self): self.test = TestManager(self, self.options.tmpdir) self.test.add_all_connections(self.nodes) NetworkThread().start() # Start up network handling in another thread - sync_masternodes(self.nodes) + sync_masternodes(self.nodes, True) self.test.run() def add_transactions_to_block(self, block, tx_list): diff --git a/qa/rpc-tests/test_framework/test_framework.py b/qa/rpc-tests/test_framework/test_framework.py index 884de4095a1b2..cb270ba8bd3fb 100755 --- a/qa/rpc-tests/test_framework/test_framework.py +++ b/qa/rpc-tests/test_framework/test_framework.py @@ -301,11 +301,11 @@ def setup_network(self): self.sync_all() set_mocktime(get_mocktime() + 1) set_node_times(self.nodes, get_mocktime()) - sync_masternodes(self.nodes) + sync_masternodes(self.nodes, True) for i in range(1, self.mn_count + 1): res = self.nodes[0].masternode("start-alias", "mn%d" % i) assert (res["result"] == 'successful') - sync_masternodes(self.nodes) + sync_masternodes(self.nodes, True) mn_info = self.nodes[0].masternodelist("status") assert (len(mn_info) == self.mn_count) for status in mn_info.values(): diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py index 6cb94be5922ad..e6d2045676481 100644 --- a/qa/rpc-tests/test_framework/util.py +++ b/qa/rpc-tests/test_framework/util.py @@ -105,11 +105,15 @@ def get_mnsync_status(node): result = node.mnsync("status") return result['IsSynced'] -def wait_to_sync(node): - synced = False - while not synced: +def wait_to_sync(node, fast_mnsync=False): + while True: synced = get_mnsync_status(node) - time.sleep(0.5) + if synced: + break + time.sleep(0.2) + if fast_mnsync: + # skip mnsync states + node.mnsync("next") def p2p_port(n): assert(n <= MAX_NODES) @@ -191,9 +195,9 @@ def sync_mempools(rpc_connections, *, wait=1, timeout=60): timeout -= wait raise AssertionError("Mempool sync failed") -def sync_masternodes(rpc_connections): +def sync_masternodes(rpc_connections, fast_mnsync=False): for node in rpc_connections: - wait_to_sync(node) + wait_to_sync(node, fast_mnsync) bitcoind_processes = {}