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:
Rusty Russell
2017-04-27 15:37:50 +09:30
committed by Christian Decker
parent 8016dbbc91
commit aa01b7d120
2 changed files with 34 additions and 0 deletions

View File

@@ -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