pytest: fix flake in test_splicing.py::test_route_by_old_scid
What changed, and why it matters
This commit fixes a flaky test in Core Lightning's splicing test suite. The test sometimes failed during cleanup because one node hadn't yet received updated network gossip about a newly spliced channel, causing it to log a harmless warning that the test framework treated as an error. The fix adds a wait condition so the test only proceeds after the gossip has propagated. There is no security issue here.
No security action required. This is a test reliability fix; normal review/merge procedures apply.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies tests/test_splicing.py::test_route_by_old_scid. After a splice and payment, the test immediately performs a second splice. If node l1 hasn’t yet processed the channel_announcement for the new splice’s short_channel_id, gossipd logs ‘Bad gossip order: channel_announcement: no unspent txout’ and emits a WIRE_WARNING. The test harness treats unexpected warnings as teardown failures. The fix inserts a wait_for() polling l1.rpc.listchannels(short_channel_id=scid) until the new channel announcement is visible, ensuring gossip propagation before the next splice.
Changed components
tests/test_splicing.pyInspect captured patch +5 / −0
diff --git a/tests/test_splicing.py b/tests/test_splicing.py
index 4974b914..996afcec 100644
--- a/tests/test_splicing.py
+++ b/tests/test_splicing.py
@@ -527,6 +527,11 @@ def test_route_by_old_scid(node_factory, bitcoind):
l1.rpc.sendpay(route, inv['payment_hash'], payment_secret=inv['payment_secret'])
l1.rpc.waitsendpay(inv['payment_hash'])
+ # Make sure l1 has seen and processed announcement for new splice
+ # scid, otherwise we can get gossip warning here (which breaks CI) if we splice again.
+ scid = only_one(l3.rpc.listchannels(source=l3.info['id'])['channels'])['short_channel_id']
+ wait_for(lambda: l1.rpc.listchannels(short_channel_id=scid)['channels'] != [])
+
# Let's splice again, so the original scid is two behind the times.
l3.fundwallet(200000)
funds_result = l3.rpc.fundpsbt("109000sat", "slow", 166, excess_as_change=True)
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.