mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge #18474: test: check that peer is connected when calling sync_*
fac3716b09bb9ee121db629873d9694a95cae942 test: check that peer is connected when calling sync_* (MarcoFalke) Pull request description: Without a connection there is no way to sync, so we can fail early and don't have to wait for the timeout ACKs for top commit: jonatack: ACK fac3716b09bb9 Tree-SHA512: 12f771473c23e152dae4bfb201fadb2c3530cf439de64fea07d048734614543080a5d05c9c36e6e398c6a69c8279f609d34706599571814172a11bcfbea4a3b9
This commit is contained in:
parent
c0e3829631
commit
4b70ee4f24
@ -489,9 +489,12 @@ def sync_blocks(rpc_connections, *, wait=1, timeout=60):
|
|||||||
best_hash = [x.getbestblockhash() for x in rpc_connections]
|
best_hash = [x.getbestblockhash() for x in rpc_connections]
|
||||||
if best_hash.count(best_hash[0]) == len(rpc_connections):
|
if best_hash.count(best_hash[0]) == len(rpc_connections):
|
||||||
return
|
return
|
||||||
|
# Check that each peer has at least one connection
|
||||||
|
assert (all([len(x.getpeerinfo()) for x in rpc_connections]))
|
||||||
time.sleep(wait)
|
time.sleep(wait)
|
||||||
raise AssertionError("Block sync timed out:{}".format("".join("\n {!r}".format(b) for b in best_hash)))
|
raise AssertionError("Block sync timed out:{}".format("".join("\n {!r}".format(b) for b in best_hash)))
|
||||||
|
|
||||||
|
|
||||||
def sync_mempools(rpc_connections, *, wait=1, timeout=60, flush_scheduler=True, wait_func=None):
|
def sync_mempools(rpc_connections, *, wait=1, timeout=60, flush_scheduler=True, wait_func=None):
|
||||||
"""
|
"""
|
||||||
Wait until everybody has the same transactions in their memory
|
Wait until everybody has the same transactions in their memory
|
||||||
@ -506,6 +509,8 @@ def sync_mempools(rpc_connections, *, wait=1, timeout=60, flush_scheduler=True,
|
|||||||
for r in rpc_connections:
|
for r in rpc_connections:
|
||||||
r.syncwithvalidationinterfacequeue()
|
r.syncwithvalidationinterfacequeue()
|
||||||
return
|
return
|
||||||
|
# Check that each peer has at least one connection
|
||||||
|
assert (all([len(x.getpeerinfo()) for x in rpc_connections]))
|
||||||
if wait_func is not None:
|
if wait_func is not None:
|
||||||
wait_func()
|
wait_func()
|
||||||
time.sleep(wait)
|
time.sleep(wait)
|
||||||
|
Loading…
Reference in New Issue
Block a user