MCPcopy Create free account
hub / github.com/ElementsProject/elements / sync_all

Function sync_all

contrib/assets_tutorial/test_framework/daemon.py:93–105  ·  view source on GitHub ↗
(nodes, timeout_sec = 10)

Source from the content-addressed store, hash-verified

91 return self.config[key]
92
93def sync_all(nodes, timeout_sec = 10):
94 stop_time = time.time() + timeout_sec
95 while time.time() <= stop_time:
96 best_hash = [x.getbestblockhash() for x in nodes]
97 if best_hash.count(best_hash[0]) == len(nodes):
98 break
99 time.sleep(1)
100 while time.time() <= stop_time:
101 pool = [set(x.getrawmempool()) for x in nodes]
102 if pool.count(pool[0]) == len(nodes):
103 return
104 time.sleep(1)
105 raise Exception("Nodes cannot sync blocks or mempool!")
106

Callers 2

assets_tutorial.pyFile · 0.90

Calls 2

ExceptionClass · 0.85
countMethod · 0.80

Tested by

no test coverage detected