tests: fix broken race handler in test_funding_external_wallet_corners
What changed, and why it matters
This is a one-line fix to a flaky automated test. The test was supposed to tolerate a harmless race condition where a peer disconnects during connection, but the assertion was checking the wrong part of the error object, so the test failed when the race actually happened. The change makes the test check the error message text instead of the dictionary keys. It does not change any production code or affect real users' funds or node security.
No security action required. This is a test-only reliability fix; routine merge is appropriate.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In tests/test_connection.py, the test_funding_external_wallet_corners test wraps l1.rpc.connect() in a try/except RpcError block to tolerate a ‘disconnected during connection’ race. The original assertion used ‘disconnected during connection’ in err.error, where err.error is a dict {‘code’: 402, ‘message’: ‘…’}. Python’s ‘in’ operator on a dict checks keys, so the substring was never found in the keys and the assertion failed precisely when the intended race occurred. The patch changes the check to err.error[‘message’], matching the pattern already used in test_plugin.py and test_misc.py. This is purely a test reliability fix.
Changed components
tests/test_connection.pyInspect captured patch +1 / −1
diff --git a/tests/test_connection.py b/tests/test_connection.py
index 5d843f4b..f19fb88b 100644
--- a/tests/test_connection.py
+++ b/tests/test_connection.py
@@ -1378,7 +1378,7 @@ def test_funding_external_wallet_corners(node_factory, bitcoind):
try:
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
except RpcError as err:
- assert "disconnected during connection" in err.error
+ assert "disconnected during connection" in err.error['message']
l1.daemon.wait_for_log('Responded to reestablish for long-closed channel')
wait_for(lambda: len(l1.rpc.listpeers()['peers']) == 0)
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.