@@ -393,6 +393,7 @@ def connect_nodes(from_connection, node_num):
393
393
# with transaction relaying
394
394
wait_until (lambda : all (peer ['version' ] != 0 for peer in from_connection .getpeerinfo ()))
395
395
396
+
396
397
def sync_blocks (rpc_connections , * , wait = 1 , timeout = 60 ):
397
398
"""
398
399
Wait until everybody has the same tip.
@@ -406,9 +407,12 @@ def sync_blocks(rpc_connections, *, wait=1, timeout=60):
406
407
best_hash = [x .getbestblockhash () for x in rpc_connections ]
407
408
if best_hash .count (best_hash [0 ]) == len (rpc_connections ):
408
409
return
410
+ # Check that each peer has at least one connection
411
+ assert (all ([len (x .getpeerinfo ()) for x in rpc_connections ]))
409
412
time .sleep (wait )
410
413
raise AssertionError ("Block sync timed out:{}" .format ("" .join ("\n {!r}" .format (b ) for b in best_hash )))
411
414
415
+
412
416
def sync_mempools (rpc_connections , * , wait = 1 , timeout = 60 , flush_scheduler = True ):
413
417
"""
414
418
Wait until everybody has the same transactions in their memory
@@ -422,6 +426,8 @@ def sync_mempools(rpc_connections, *, wait=1, timeout=60, flush_scheduler=True):
422
426
for r in rpc_connections :
423
427
r .syncwithvalidationinterfacequeue ()
424
428
return
429
+ # Check that each peer has at least one connection
430
+ assert (all ([len (x .getpeerinfo ()) for x in rpc_connections ]))
425
431
time .sleep (wait )
426
432
raise AssertionError ("Mempool sync timed out:{}" .format ("" .join ("\n {!r}" .format (m ) for m in pool )))
427
433
0 commit comments