pytest: Yet another instance where we wait only on one side

Waiting on one end and then just asserting on the other is racy.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2018-05-20 19:39:48 -07:00
committed by Rusty Russell
parent f1c64db5e7
commit 1a9c7783b7

View File

@@ -1584,10 +1584,14 @@ class LightningDTests(BaseLightningDTests):
['ONCHAIN:Tracking their unilateral close',
'ONCHAIN:All outputs resolved: waiting 99 more blocks before forgetting channel'])
def check_billboard():
billboard = l2.rpc.listpeers(l1.info['id'])['peers'][0]['channels'][0]['status']
assert len(billboard) == 2
assert billboard[0] == 'ONCHAIN:Tracking our own unilateral close'
assert re.fullmatch('ONCHAIN:.* outputs unresolved: in 4 blocks will spend DELAYED_OUTPUT_TO_US \(.*:0\) using OUR_DELAYED_RETURN_TO_WALLET', billboard[1])
return (
len(billboard) == 2 and
billboard[0] == 'ONCHAIN:Tracking our own unilateral close' and
re.fullmatch('ONCHAIN:.* outputs unresolved: in 4 blocks will spend DELAYED_OUTPUT_TO_US \(.*:0\) using OUR_DELAYED_RETURN_TO_WALLET', billboard[1])
)
wait_for(check_billboard)
# Now, mine 4 blocks so it sends out the spending tx.
bitcoind.generate_block(4)