From 38510202c4a34febd70b35c0e52c8afe4d3599d4 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 1 Feb 2023 12:29:32 +1030 Subject: [PATCH] pytest: fix flake in test_closing_simple when we mine too fast. We can actually catch l2 with HTLCs still closing and mine blocks, then it force closes due to HTLC timeout. Signed-off-by: Rusty Russell --- tests/test_closing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_closing.py b/tests/test_closing.py index e540a8d79..5cab7aa76 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -46,6 +46,8 @@ def test_closing_simple(node_factory, bitcoind, chainparams): # check for the substring assert 'CHANNELD_NORMAL:Channel ready for use.' in billboard[0] + # Make sure all HTLCs resolved before we close! + wait_for(lambda: only_one(l2.rpc.listpeerchannels()['channels'])['htlcs'] == []) l1.rpc.close(chan) l1.daemon.wait_for_log(' to CHANNELD_SHUTTING_DOWN')