pytest: fix bad gossip flake in test_buy_liquidity_ad_check_bookkeeping
What changed, and why it matters
This change only adds a wait step inside a single test so that the test does not fail intermittently. It does not change any production code, so it cannot affect real users or introduce a security vulnerability.
No security action needed; this is a test-only reliability fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies tests/test_opening.py to wait for all channels to become active before proceeding in test_buy_liquidity_ad_check_bookkeeping. Without this wait, the test could close a channel before gossip announcements are fully processed, causing a harmless but flaky ‘bad gossip’ warning. No daemon or protocol code is changed.
Changed components
tests/test_opening.pyInspect captured patch +5 / −0
diff --git a/tests/test_opening.py b/tests/test_opening.py
index 2261bcd1..b1bf9406 100644
--- a/tests/test_opening.py
+++ b/tests/test_opening.py
@@ -1976,6 +1976,11 @@ def test_buy_liquidity_ad_check_bookkeeping(node_factory, bitcoind):
bitcoind.generate_block(2)
l1.daemon.wait_for_log('to CHANNELD_NORMAL')
+ # Avoid bad gossip messages caused by channel announcements being
+ # processed after closing.
+ for n in (l1, l2):
+ wait_for(lambda: all([c['active'] for c in n.rpc.listchannels()['channels']]))
+
chan_id = first_channel_id(l1, l2)
ev_tags = [e['tag'] for e in l1.rpc.bkpr_listaccountevents(chan_id)['events']]
assert 'lease_fee' in ev_tags
Why this scored 13/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.