mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
pytest: fix flake in test_peer_anchor_push
If l1 is one block behind, l2 goes onchain one block early: ``` # Drops to chain > wait_for(lambda: only_one(l2.rpc.listpeerchannels(l3.info['id'])['channels'])['state'] == 'AWAITING_UNILATERAL') tests/test_closing.py:3951: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ success = <function test_peer_anchor_push.<locals>.<lambda> at 0x7f799f9cd1f0> timeout = 180 def wait_for(success, timeout=TIMEOUT): start_time = time.time() interval = 0.25 while not success(): time_left = start_time + timeout - time.time() if time_left <= 0: > raise ValueError("Timeout while waiting for {}".format(success)) E ValueError: Timeout while waiting for <function test_peer_anchor_push.<locals>.<lambda> at 0x7f799f9cd1f0> ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
bf9cdc597e
commit
af4b244f2f
1 changed files with 4 additions and 1 deletions
|
@ -3919,7 +3919,7 @@ def test_peer_anchor_push(node_factory, bitcoind, executor, chainparams):
|
|||
psbt = l2.rpc.addpsbtoutput(OUTPUT_SAT, psbt)['psbt']
|
||||
l2.rpc.sendpsbt(l2.rpc.signpsbt(psbt)['signed_psbt'])
|
||||
bitcoind.generate_block(1, wait_for_mempool=1)
|
||||
sync_blockheight(bitcoind, [l2])
|
||||
sync_blockheight(bitcoind, [l1, l2])
|
||||
|
||||
# Make sure all amounts are below OUTPUT_SAT sats!
|
||||
assert [x for x in l2.rpc.listfunds()['outputs'] if x['amount_msat'] > Millisatoshi(str(OUTPUT_SAT) + "sat")] == []
|
||||
|
@ -3931,6 +3931,9 @@ def test_peer_anchor_push(node_factory, bitcoind, executor, chainparams):
|
|||
l1.rpc.sendpay(route, sticky_inv['payment_hash'], payment_secret=sticky_inv['payment_secret'])
|
||||
l3.daemon.wait_for_log('dev_disconnect: -WIRE_UPDATE_FULFILL_HTLC')
|
||||
|
||||
# Make sure HTLC expiry is what we expect!
|
||||
l2.daemon.wait_for_log('Adding HTLC 0 amount=100000000msat cltv=119 gave CHANNEL_ERR_ADD_OK')
|
||||
|
||||
# l3 drops to chain, but make sure it doesn't CPFP its own anchor.
|
||||
wait_for(lambda: only_one(l3.rpc.listpeerchannels(l2.info['id'])['channels'])['htlcs'] != [])
|
||||
closetx = l3.rpc.dev_sign_last_tx(l2.info['id'])['tx']
|
||||
|
|
Loading…
Add table
Reference in a new issue