From 9d5841a0e66ae19ff493b9c991e9b00023e15356 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 14 Jan 2023 12:58:59 +1030 Subject: [PATCH] pytest: fix flake in tests/test_closing.py::test_closing_specified_destination The close call can fail, since we already unilaterally closed since we mined blocks too fast: ``` 2023-01-14T01:00:10.2502199Z E pyln.client.lightning.RpcError: RPC call failed: method: close, payload: ['107x1x1', None, 'bcrt1qeyyk6sl5pr49ycpqyckvmttus5ttj25pd0zpvg'], error: {'code': -32602, 'message': "Short channel ID not active: '107x1x1'"} ... 2023-01-14T01:00:10.5288050Z lightningd-4 2023-01-14T00:59:59.650Z UNUSUAL 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-chan#1: Peer permanent failure in CHANNELD_NORMAL: Fulfilled HTLC 0 SENT_REMOVE_COMMIT cltv 113 hit deadline ``` Signed-off-by: Rusty Russell --- tests/test_closing.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_closing.py b/tests/test_closing.py index 8f3d25433..e540a8d79 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -289,6 +289,11 @@ def test_closing_specified_destination(node_factory, bitcoind, chainparams): l1.pay(l3, 100000000) l1.pay(l4, 100000000) + # Make sure HTLCs completely expired before we mine, so they don't + # unilaterally close! + for n in l1, l2, l3, l4: + wait_for(lambda: all(c['htlcs'] == [] for c in n.rpc.listpeerchannels()['channels'])) + mine_funding_to_announce(bitcoind, [l1, l2, l3, l4]) addr = chainparams['example_addr']