From fae153b40968bfd974a4709bcd841a59447abf18 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 4 May 2020 08:48:10 -0400 Subject: [PATCH] test: Fix verack race to avoid intermittent test failures --- test/functional/test_framework/util.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 64e1aa3bbc..dc26d5b433 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -391,7 +391,11 @@ def connect_nodes(from_connection, node_num): from_connection.addnode(ip_port, "onetry") # poll until version handshake complete to avoid race conditions # with transaction relaying - wait_until(lambda: all(peer['version'] != 0 for peer in from_connection.getpeerinfo())) + # See comments in net_processing: + # * Must have a version message before anything else + # * Must have a verack message before anything else + wait_until(lambda: all(peer['version'] != 0 for peer in from_connection.getpeerinfo())) + wait_until(lambda: all(peer['bytesrecv_per_msg'].pop('verack', 0) == 24 for peer in from_connection.getpeerinfo())) def sync_blocks(rpc_connections, *, wait=1, timeout=60):