mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
pytest: fix flake in test_channel_lease_post_expiry
We close the channel because the payment fulfilment is not totally done, and
we generate 6 blocks, causing it to hit CLTV deadline.
```
# send some payments, mine a block or two
inv = l2.rpc.invoice(10**4, '1', 'no_1')
l1.rpc.pay(inv['bolt11'])
# l2 attempts to close a channel that it leased, should fail
with pytest.raises(RpcError, match=r'Peer leased this channel from us'):
l2.rpc.close(l1.get_channel_scid(l2))
bitcoind.generate_block(6)
sync_blockheight(bitcoind, [l1, l2])
# make sure we're at the right place for the csv lock
> l2.daemon.wait_for_log('Blockheight: SENT_ADD_ACK_COMMIT->RCVD_ADD_ACK_REVOCATION LOCAL now 115')
tests/test_closing.py:823:
...
lightningd-2 2022-07-17T13:15:34.242Z DEBUG lightningd: Adding block 115: 39d95061935e9fc42b04c86ae60d0cf157765aff4c040f3a8d0b7888db19e015
lightningd-2 2022-07-17T13:15:34.244Z UNUSUAL 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-chan#2: Peer permanent failure in CHANNELD_NORMAL: Fulfilled HTLC 0 SENT_REMOVE_COMMIT cltv 115 hit deadline
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
neil saitug
parent
099d149104
commit
acc9dc4852
@@ -813,6 +813,10 @@ def test_channel_lease_post_expiry(node_factory, bitcoind, chainparams):
|
||||
inv = l2.rpc.invoice(10**4, '1', 'no_1')
|
||||
l1.rpc.pay(inv['bolt11'])
|
||||
|
||||
# make sure it's completely resolved before we generate blocks,
|
||||
# otherwise it can close HTLC!
|
||||
wait_for(lambda: only_one(only_one(l2.rpc.listpeers()['peers'])['channels'])['htlcs'] == [])
|
||||
|
||||
# l2 attempts to close a channel that it leased, should fail
|
||||
with pytest.raises(RpcError, match=r'Peer leased this channel from us'):
|
||||
l2.rpc.close(l1.get_channel_scid(l2))
|
||||
|
||||
Reference in New Issue
Block a user