diff --git a/test/functional/p2p_ibd_txrelay.py b/test/functional/p2p_ibd_txrelay.py --- a/test/functional/p2p_ibd_txrelay.py +++ b/test/functional/p2p_ibd_txrelay.py @@ -8,7 +8,6 @@ from test_framework.messages import XEC from test_framework.test_framework import BitcoinTestFramework -from test_framework.util import assert_equal MAX_FEE_FILTER = Decimal(9170997) / XEC NORMAL_FEE_FILTER = Decimal(100) / XEC @@ -28,8 +27,8 @@ "Check that nodes set minfilter to MAX_MONEY while still in IBD") for node in self.nodes: assert node.getblockchaininfo()['initialblockdownload'] - for conn_info in node.getpeerinfo(): - assert_equal(conn_info['minfeefilter'], MAX_FEE_FILTER) + self.wait_until(lambda: all(peer['minfeefilter'] == MAX_FEE_FILTER + for peer in node.getpeerinfo())) # Come out of IBD by generating a block self.nodes[0].generate(1) @@ -39,8 +38,9 @@ "Check that nodes reset minfilter after coming out of IBD") for node in self.nodes: assert not node.getblockchaininfo()['initialblockdownload'] - for conn_info in node.getpeerinfo(): - assert_equal(conn_info['minfeefilter'], NORMAL_FEE_FILTER) + self.wait_until( + lambda: all(peer['minfeefilter'] == NORMAL_FEE_FILTER + for peer in node.getpeerinfo())) if __name__ == '__main__': diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -33,6 +33,7 @@ p2p_port, PortSeed, rpc_port, + wait_until, ) @@ -602,6 +603,10 @@ self.sync_blocks(nodes) self.sync_mempools(nodes) + def wait_until(self, test_function, timeout=60, lock=None): + return wait_until(test_function, timeout=timeout, lock=lock, + timeout_factor=self.options.timeout_factor) + # Private helper methods. These should not be accessed by the subclass # test scripts.