pytest: fix flake in test_gossip_query_channel_range
What changed, and why it matters
This commit fixes a flaky test in Core Lightning's test suite. A test about gossip protocol messages sometimes failed because another node would send an unexpected extra message type during the test. The fix adds that message type to the list of messages the test should ignore, making the test more reliable. There is no security issue in the actual Lightning node software.
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 change is a one-line modification in tests/test_gossip.py. In test_gossip_query_channel_range, the filters list passed to query_gossip is expanded from [‘0109’, ‘0107’, ‘0012’] to include ‘0105’ (WIRE_QUERY_SHORT_CHANNEL_IDS). The test was intermittently failing because l4 could send a WIRE_QUERY_SHORT_CHANNEL_IDS message at an inconvenient time, causing an assertion mismatch in the expected gossip response. Filtering it out prevents the race condition from affecting test results.
Changed components
tests/test_gossip.pyInspect captured patch +1 / −1
diff --git a/tests/test_gossip.py b/tests/test_gossip.py
index 45bbd177..c8d700e1 100644
--- a/tests/test_gossip.py
+++ b/tests/test_gossip.py
@@ -748,7 +748,7 @@ def test_gossip_query_channel_range(node_factory, bitcoind, chainparams):
msgs = l4.query_gossip('query_channel_range',
chainparams['chain_hash'],
0, 1000000,
- filters=['0109', '0107', '0012'])
+ filters=['0109', '0107', '0012', '0105'])
# Either order!
encoded1 = subprocess.run(['devtools/mkencoded', '--scids', '00', scid12, scid23],
check=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.