Wait until everybody has the same transactions in their memory pools
(rpc_connections, *, wait=1, timeout=60)
| 393 | raise AssertionError("Chain sync failed: Best block hashes don't match") |
| 394 | |
| 395 | def sync_mempools(rpc_connections, *, wait=1, timeout=60): |
| 396 | """ |
| 397 | Wait until everybody has the same transactions in their memory |
| 398 | pools |
| 399 | """ |
| 400 | while timeout > 0: |
| 401 | pool = set(rpc_connections[0].getrawmempool()) |
| 402 | num_match = 1 |
| 403 | for i in range(1, len(rpc_connections)): |
| 404 | if set(rpc_connections[i].getrawmempool()) == pool: |
| 405 | num_match = num_match + 1 |
| 406 | if num_match == len(rpc_connections): |
| 407 | return |
| 408 | time.sleep(wait) |
| 409 | timeout -= wait |
| 410 | raise AssertionError("Mempool sync failed") |
| 411 | |
| 412 | # Transaction/Block functions |
| 413 | ############################# |