Skip to content

Commit b654479

Browse files
fanquakePastaPastaPasta
authored andcommitted
Merge bitcoin#30705: test: Avoid intermittent block download timeout in p2p_ibd_stalling
fa5b58e test: Avoid intermittent block download timeout in p2p_ibd_stalling (MarcoFalke) Pull request description: Fixes bitcoin#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 fa5b58e brunoerg: utACK fa5b58e Tree-SHA512: 9a9221f264bea52be5e9fe81fd319f5a6970cd315cc5e9f5e2e049c5d84619b19b9f6f075cda8d34565c2d6c17a88fb57e195c66c271e40f73119a77caecb6d7
1 parent 745a819 commit b654479

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/functional/p2p_ibd_stalling.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def run_test(self):
7676
peers = []
7777

7878
self.log.info("Check that a staller does not get disconnected if the 1024 block lookahead buffer is filled")
79+
self.mocktime = int(time.time()) + 1
7980
for id in range(NUM_PEERS):
8081
peers.append(node.add_outbound_p2p_connection(P2PStaller(stall_block), services = NODE_NETWORK | NODE_BLOOM, p2p_idx=id, connection_type="outbound-full-relay"))
8182
peers[-1].block_store = block_dict
@@ -88,7 +89,7 @@ def run_test(self):
8889

8990
self.all_sync_send_with_ping(peers)
9091
# If there was a peer marked for stalling, it would get disconnected
91-
self.mocktime = int(time.time()) + 3
92+
self.mocktime += 3
9293
node.setmocktime(self.mocktime)
9394
self.all_sync_send_with_ping(peers)
9495
assert_equal(node.num_test_p2p_connections(), NUM_PEERS)

0 commit comments

Comments
 (0)