Skip to content

Commit fae153b

Browse files
author
MarcoFalke
committed
test: Fix verack race to avoid intermittent test failures
1 parent ae32e5c commit fae153b

File tree

1 file changed

+5
-1
lines changed
  • test/functional/test_framework

1 file changed

+5
-1
lines changed

test/functional/test_framework/util.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,11 @@ def connect_nodes(from_connection, node_num):
391391
from_connection.addnode(ip_port, "onetry")
392392
# poll until version handshake complete to avoid race conditions
393393
# with transaction relaying
394-
wait_until(lambda: all(peer['version'] != 0 for peer in from_connection.getpeerinfo()))
394+
# See comments in net_processing:
395+
# * Must have a version message before anything else
396+
# * Must have a verack message before anything else
397+
wait_until(lambda: all(peer['version'] != 0 for peer in from_connection.getpeerinfo()))
398+
wait_until(lambda: all(peer['bytesrecv_per_msg'].pop('verack', 0) == 24 for peer in from_connection.getpeerinfo()))
395399

396400

397401
def sync_blocks(rpc_connections, *, wait=1, timeout=60):

0 commit comments

Comments
 (0)