tests/test_misc.py: fix another "AF_UNIX path too long"
What changed, and why it matters
This is a tiny test-only cleanup. It replaces a direct Unix socket connection helper with a shared test helper and explicitly closes an old socket to avoid a resource leak during automated tests. There is no change to production code or user-facing security.
No security action required. Treat as routine test maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies tests/test_misc.py only. In test_malformed_rpc, it closes the existing AF_UNIX socket before creating a new one, and uses connect_unix() instead of manually constructing socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) and calling connect(). This addresses test flakiness from ‘AF_UNIX path too long’ and prevents a socket resource leak in the test harness. No Core Lightning daemon code is changed.
Changed components
tests/test_misc.pyInspect captured patch +2 / −2
diff --git a/tests/test_misc.py b/tests/test_misc.py
index 00fc0d6a..e17d4935 100644
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -970,8 +970,8 @@ def test_malformed_rpc(node_factory):
obj, _ = l1.rpc._readobj(sock, b'')
assert obj['error']['code'] == -32600
- sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
- sock.connect(l1.rpc.socket_path)
+ sock.close()
+ sock = connect_unix(l1.rpc.socket_path)
# Bad ID
sock.sendall(b'{"id":{}, "jsonrpc":"2.0","method":"getinfo","params":[]}')
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.