pytest: fix flae int test_fetchinvoice_autoconnect.
What changed, and why it matters
This commit fixes a flaky test in the Core Lightning test suite. The test was waiting until a node learned about another node's existence, but it actually needed to wait until it also learned the node's network address. No production code was changed, and there is no security issue.
No security action required. This is a routine test flake fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change is in tests/test_pay.py in test_fetchinvoice_autoconnect. The wait_for condition is tightened from merely checking that listnodes returns a non-empty list for l2, to checking that the returned node entries include ‘addresses’. This ensures l3 has received l2’s node_announcement (which carries addresses) before fetchinvoice is called, preventing a routing failure due to missing peer address. It is a test-only reliability fix.
Changed components
tests/test_pay.py::test_fetchinvoice_autoconnectInspect captured patch +1 / −1
diff --git a/tests/test_pay.py b/tests/test_pay.py
index 5ab969af..1f31762c 100644
--- a/tests/test_pay.py
+++ b/tests/test_pay.py
@@ -4797,7 +4797,7 @@ def test_fetchinvoice_autoconnect(node_factory, bitcoind):
l3 = node_factory.get_node()
l3.rpc.connect(l1.info['id'], 'localhost', l1.port)
- wait_for(lambda: l3.rpc.listnodes(l2.info['id'])['nodes'] != [])
+ wait_for(lambda: ['addresses' in n for n in l3.rpc.listnodes(l2.info['id'])['nodes']] == [True])
offer = l2.rpc.call('offer', {'amount': '2msat',
'description': 'simple test'})
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.