mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
test_lightningd.py: helper to sync blockheight.
We need this to avoid spurious errors in the next patch. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
8016dbbc91
commit
aa01b7d120
@@ -37,6 +37,19 @@ def setupBitcoind():
|
||||
logging.debug("Insufficient balance, generating 1 block")
|
||||
bitcoind.rpc.generate(1)
|
||||
|
||||
def sync_blockheight(*args):
|
||||
while True:
|
||||
target = bitcoind.rpc.getblockcount()
|
||||
all_up_to_date = True
|
||||
for l in args:
|
||||
if l.rpc.dev_blockheight()['blockheight'] != target:
|
||||
all_up_to_date = False
|
||||
|
||||
if all_up_to_date:
|
||||
return
|
||||
|
||||
# Sleep before spinning.
|
||||
time.sleep(0.1)
|
||||
|
||||
def tearDownBitcoind():
|
||||
global bitcoind
|
||||
|
||||
Reference in New Issue
Block a user