From 2706c5b7c8eee7ffd8c3b23a8012f346165ddb93 Mon Sep 17 00:00:00 2001 From: Greg Sanders Date: Thu, 6 Feb 2025 11:34:56 -0500 Subject: [PATCH] test: test_inv_block, use mocktime instead of waiting --- test/functional/p2p_tx_download.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/functional/p2p_tx_download.py b/test/functional/p2p_tx_download.py index a74d763d6ec..b96ffc6222b 100755 --- a/test/functional/p2p_tx_download.py +++ b/test/functional/p2p_tx_download.py @@ -105,6 +105,8 @@ def test_inv_block(self): tx = self.wallet.create_self_transfer() wtxid = int(tx['wtxid'], 16) + self.nodes[0].setmocktime(int(time.time())) + self.log.info( "Announce the transaction to all nodes from all {} incoming peers, but never send it".format(NUM_INBOUND)) msg = msg_inv([CInv(t=MSG_WTX, h=wtxid)]) @@ -125,7 +127,10 @@ def test_inv_block(self): assert self.nodes[1].getpeerinfo()[0]['inbound'] == False timeout = 2 + INBOUND_PEER_TX_DELAY + GETDATA_TX_INTERVAL self.log.info("Tx should be received at node 1 after {} seconds".format(timeout)) - self.sync_mempools(timeout=timeout) + self.nodes[0].bumpmocktime(timeout) + self.sync_mempools() + + self.nodes[0].setmocktime(0) def test_in_flight_max(self): self.log.info("Test that we don't load peers with more than {} transaction requests immediately".format(MAX_GETDATA_IN_FLIGHT))