Wait until everybody has the same transactions in their memory pools
(rpc_connections, *, wait=1, timeout=60, flush_scheduler=True)
| 392 | raise AssertionError("Block sync timed out:{}".format("".join("\n {!r}".format(b) for b in best_hash))) |
| 393 | |
| 394 | def sync_mempools(rpc_connections, *, wait=1, timeout=60, flush_scheduler=True): |
| 395 | """ |
| 396 | Wait until everybody has the same transactions in their memory |
| 397 | pools |
| 398 | """ |
| 399 | stop_time = time.time() + timeout |
| 400 | while time.time() <= stop_time: |
| 401 | pool = [set(r.getrawmempool()) for r in rpc_connections] |
| 402 | if pool.count(pool[0]) == len(rpc_connections): |
| 403 | if flush_scheduler: |
| 404 | for r in rpc_connections: |
| 405 | r.syncwithvalidationinterfacequeue() |
| 406 | return |
| 407 | time.sleep(wait) |
| 408 | raise AssertionError("Mempool sync timed out:{}".format("".join("\n {!r}".format(m) for m in pool))) |
| 409 | |
| 410 | # Transaction/Block functions |
| 411 | ############################# |