Skip to content

Commit edc3d1b

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#26854: test: Fix intermittent timeout in p2p_permissions.py
fa1bf4e test: Fix intermittent timeout in p2p_permissions.py (MarcoFalke) Pull request description: The sync is based on `bytesrecv_per_msg["verack"]`. However, the bytes are counted before processing the message, so they are not sufficient to ensure the connection is fully up. ACKs for top commit: mzumsande: ACK fa1bf4e aureleoules: ACK fa1bf4e Tree-SHA512: eb1ed537032c76a449b1ed5e42ff062e9b8b3c7e11fde2a5b8183ae0d6fbe31dba39e2c758836160cd8157d9ac5cc1f5d1916415861b8d711b7370c88f5e9790
2 parents bd74004 + fa1bf4e commit edc3d1b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/functional/test_framework/test_framework.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,10 @@ def connect_nodes(self, a, b):
608608
self.wait_until(lambda: sum(peer['version'] != 0 for peer in to_connection.getpeerinfo()) == to_num_peers)
609609
self.wait_until(lambda: sum(peer['bytesrecv_per_msg'].pop('verack', 0) == 24 for peer in from_connection.getpeerinfo()) == from_num_peers)
610610
self.wait_until(lambda: sum(peer['bytesrecv_per_msg'].pop('verack', 0) == 24 for peer in to_connection.getpeerinfo()) == to_num_peers)
611+
# The message bytes are counted before processing the message, so make
612+
# sure it was fully processed by waiting for a ping.
613+
self.wait_until(lambda: sum(peer["bytesrecv_per_msg"].pop("pong", 0) >= 32 for peer in from_connection.getpeerinfo()) == from_num_peers)
614+
self.wait_until(lambda: sum(peer["bytesrecv_per_msg"].pop("pong", 0) >= 32 for peer in to_connection.getpeerinfo()) == to_num_peers)
611615

612616
def disconnect_nodes(self, a, b):
613617
def disconnect_nodes_helper(node_a, node_b):

0 commit comments

Comments
 (0)