Skip to content

Commit 0a1b6fa

Browse files
committed
test: fix intermittent timeouts in p2p_timeouts.py
by checking that all nodes are added before the mocktime is bumped. Fixes #23800
1 parent 98a2ddc commit 0a1b6fa

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test/functional/p2p_timeouts.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,13 @@ def run_test(self):
4848
self.mock_time = int(time.time())
4949
self.mock_forward(0)
5050

51-
# Setup the p2p connections
52-
no_verack_node = self.nodes[0].add_p2p_connection(TestP2PConn(), wait_for_verack=False)
53-
no_version_node = self.nodes[0].add_p2p_connection(TestP2PConn(), send_version=False, wait_for_verack=False)
54-
no_send_node = self.nodes[0].add_p2p_connection(TestP2PConn(), send_version=False, wait_for_verack=False)
51+
# Setup the p2p connections, making sure the connections are established before the mocktime is bumped
52+
with self.nodes[0].assert_debug_log(['Added connection peer=0']):
53+
no_verack_node = self.nodes[0].add_p2p_connection(TestP2PConn(), wait_for_verack=False)
54+
with self.nodes[0].assert_debug_log(['Added connection peer=1']):
55+
no_version_node = self.nodes[0].add_p2p_connection(TestP2PConn(), send_version=False, wait_for_verack=False)
56+
with self.nodes[0].assert_debug_log(['Added connection peer=2']):
57+
no_send_node = self.nodes[0].add_p2p_connection(TestP2PConn(), send_version=False, wait_for_verack=False)
5558

5659
# Wait until we got the verack in response to the version. Though, don't wait for the other node to receive the
5760
# verack, since we never sent one

0 commit comments

Comments
 (0)