From 3e679156ffc3ca651787bc43bc7da1cadd343185 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 9 Jul 2025 11:30:23 +0930 Subject: [PATCH] pytest: fix flake in test_splicing_rbf We get a unilateral close if the blocks come too fast: ``` > l2.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL') tests/test_splicing.py:96: ... > raise TimeoutError('Unable to find "{}" in logs.'.format(exs)) E TimeoutError: Unable to find "[re.compile('CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL')]" in logs. ``` Here: ``` lightningd-2 2025-07-08T12:08:30.430Z DEBUG lightningd: Adding block 114: 542499dfc63bc94c0ba0a3d81bdaff07ab73ba9aebddd4c2ae4b2e0c1e8bd15f ... lightningd-2 2025-07-08T12:08:30.459Z UNUSUAL 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-chan#1: Peer permanent failure in CHANNELD_AWAITING_SPLICE: Fulfilled HTLC 1 RCVD_REMOVE_REVOCATION cltv11 4 hit deadline (reason=protocol) lightningd-2 2025-07-08T12:08:30.469Z DEBUG 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-channeld-chan#1: Status closed, but not exited. Killing lightningd-2 2025-07-08T12:08:30.475Z INFO 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-chan#1: State changed from CHANNELD_AWAITING_SPLICE to AWAITING_UNILATERAL ``` Signed-off-by: Rusty Russell --- tests/test_splicing.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_splicing.py b/tests/test_splicing.py index 0f1c9359a..b1a8595fd 100644 --- a/tests/test_splicing.py +++ b/tests/test_splicing.py @@ -91,6 +91,9 @@ def test_splice_rbf(node_factory, bitcoind): inv = l2.rpc.invoice(10**2, '2', 'no_2') l1.rpc.pay(inv['bolt11']) + # Make sure l1 doesn't unilateral close if HTLC hasn't completely settled before deadline. + wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['htlcs'] == []) + bitcoind.generate_block(6, wait_for_mempool=1) l2.daemon.wait_for_log(r'CHANNELD_AWAITING_SPLICE to CHANNELD_NORMAL')