pytest: fix flake in test_easy_splice_out_into_channel
What changed, and why it matters
This commit fixes a flaky test in Core Lightning's test suite. The test sometimes failed because it checked immediately whether an 'inflight' splice entry had disappeared from a channel, but the nodes l1 and l3 may not have processed the latest block yet. The fix simply waits for that condition instead of asserting it right away. There is no security issue in the production code.
No security action needed. This is a test reliability fix; review and merge as normal.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change is in tests/test_splice.py inside test_easy_splice_out_into_channel. It replaces two immediate assertions that ‘inflight’ is absent from listpeerchannels output with wait_for() calls that retry until the condition holds. This addresses a race where l1/l3 had not yet observed the block that finalizes the splice, so the inflight field was still present transiently. No protocol, RPC, or daemon code is modified.
Changed components
tests/test_splice.pyInspect captured patch +2 / −4
diff --git a/tests/test_splice.py b/tests/test_splice.py
index 37fda1f..ffa1bb6 100644
--- a/tests/test_splice.py
+++ b/tests/test_splice.py
@@ -708,10 +708,8 @@ def test_easy_splice_out_into_channel(node_factory, bitcoind, chainparams):
bitcoind.generate_block(6, wait_for_mempool=1)
l2.daemon.wait_for_log(r'lightningd, splice_locked clearing inflights')
- p1 = only_one(l1.rpc.listpeerchannels()['channels'])
- p2 = only_one(l3.rpc.listpeerchannels()['channels'])
- assert 'inflight' not in p1
- assert 'inflight' not in p2
+ wait_for(lambda: 'inflight' not in only_one(l1.rpc.listpeerchannels()['channels']))
+ wait_for(lambda: 'inflight' not in only_one(l3.rpc.listpeerchannels()['channels']))
wait_for(lambda: len(l2.rpc.listfunds()['outputs']) == 1)
wait_for(lambda: len(l2.rpc.listfunds()['channels']) == 2)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.