diff options
author | merge-script <fanquake@gmail.com> | 2024-08-27 11:20:42 +0100 |
---|---|---|
committer | merge-script <fanquake@gmail.com> | 2024-08-27 11:20:42 +0100 |
commit | e53b1c1a4bba7814a0431dfc976193761efc773a (patch) | |
tree | 2d47da26eeae17e890d2b155c163d96ff7f605e3 | |
parent | 37cdb5f2483cd57077497925caf69a82b0d39471 (diff) | |
parent | fa5b58ea01fac1adb6336b8b6b5217193295c695 (diff) |
Merge bitcoin/bitcoin#30705: test: Avoid intermittent block download timeout in p2p_ibd_stalling
fa5b58ea01fac1adb6336b8b6b5217193295c695 test: Avoid intermittent block download timeout in p2p_ibd_stalling (MarcoFalke)
Pull request description:
Fixes #30704
The goal of the test is to check the stalling timeout, not the block download timeout.
On extremely slow hardware (for example qemu virtual hardware), downloading the 1023 blocks may take longer than the block download timeout.
Fix it by pinning the time using mocktime, and only advance it when testing the stalling timeout.
ACKs for top commit:
tdb3:
CR ACK fa5b58ea01fac1adb6336b8b6b5217193295c695
brunoerg:
utACK fa5b58ea01fac1adb6336b8b6b5217193295c695
Tree-SHA512: 9a9221f264bea52be5e9fe81fd319f5a6970cd315cc5e9f5e2e049c5d84619b19b9f6f075cda8d34565c2d6c17a88fb57e195c66c271e40f73119a77caecb6d7
-rwxr-xr-x | test/functional/p2p_ibd_stalling.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/functional/p2p_ibd_stalling.py b/test/functional/p2p_ibd_stalling.py index 11cd8837f4..fa07873929 100755 --- a/test/functional/p2p_ibd_stalling.py +++ b/test/functional/p2p_ibd_stalling.py @@ -73,6 +73,7 @@ class P2PIBDStallingTest(BitcoinTestFramework): peers = [] self.log.info("Check that a staller does not get disconnected if the 1024 block lookahead buffer is filled") + self.mocktime = int(time.time()) + 1 for id in range(NUM_PEERS): peers.append(node.add_outbound_p2p_connection(P2PStaller(stall_block), p2p_idx=id, connection_type="outbound-full-relay")) peers[-1].block_store = block_dict @@ -85,7 +86,7 @@ class P2PIBDStallingTest(BitcoinTestFramework): self.all_sync_send_with_ping(peers) # If there was a peer marked for stalling, it would get disconnected - self.mocktime = int(time.time()) + 3 + self.mocktime += 3 node.setmocktime(self.mocktime) self.all_sync_send_with_ping(peers) assert_equal(node.num_test_p2p_connections(), NUM_PEERS) |