aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/util.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-05-04 08:48:10 -0400
committerMarcoFalke <falke.marco@gmail.com>2020-05-04 08:56:30 -0400
commitfae153b40968bfd974a4709bcd841a59447abf18 (patch)
treed32c81f30f12ea8a206e834f92f6b2eebc1012a4 /test/functional/test_framework/util.py
parentae32e5ce3d268881cbf631de1903b2a414bb64e1 (diff)
downloadbitcoin-fae153b40968bfd974a4709bcd841a59447abf18.tar.xz
test: Fix verack race to avoid intermittent test failures
Diffstat (limited to 'test/functional/test_framework/util.py')
-rw-r--r--test/functional/test_framework/util.py6
1 files changed, 5 insertions, 1 deletions
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):