What changed, and why it matters
This commit simply re-enables an existing test and makes it more thorough. It checks that a Core Lightning node started in 'offline' mode does not accept incoming connections but can still connect out to other nodes. There is no code change to the actual lightning software—only a test file was modified.
No security action needed. This is a test-only change improving coverage of the offline startup option.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff removes an @pytest.mark.xfail decorator from test_offline and extends the test to verify behavior: an offline node logs ‘Started in offline mode!’, still creates a local listener (the log line was previously asserted absent, now it is parsed for a port), refuses inbound connections to that port, and can still initiate outbound connections. No production code is changed.
Changed components
tests/test_connection.pyInspect captured patch +12 / −3
diff --git a/tests/test_connection.py b/tests/test_connection.py
index 78261f71..92a2a12f 100644
--- a/tests/test_connection.py
+++ b/tests/test_connection.py
@@ -4523,15 +4523,24 @@ def test_reconnect_no_additional_transient_failure(node_factory, bitcoind):
assert not l1.daemon.is_in_log(f"{l2id}-chan#1: Peer transient failure in CHANNELD_NORMAL: Disconnected", start=offset1)
-@pytest.mark.xfail(strict=True)
def test_offline(node_factory):
# if get_node starts it, it'll expect an address, so do it manually.
l1 = node_factory.get_node(options={"offline": None}, start=False)
l1.daemon.start()
- # we expect it to log offline mode an not to create any listener
+ # we expect it to log offline mode not to listen.
assert l1.daemon.is_in_log("Started in offline mode!")
- assert not l1.daemon.is_in_log("connectd: Created listener on")
+ line = l1.daemon.is_in_log("connectd: Created listener on")
+ port = re.search(r'connectd: Created listener on 127.0.0.1:(.*)', line).groups()[0]
+
+ l2 = node_factory.get_node()
+
+ # We cannot connect in!
+ with pytest.raises(RpcError, match=f"All addresses failed: 127.0.0.1:{port}: Connection establishment: Connection refused."):
+ l2.rpc.connect(l1.rpc.getinfo()['id'], 'localhost', int(port))
+
+ # We *can* connect out
+ l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
def test_last_stable_connection(node_factory):
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.