MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_offline

Function test_offline

tests/test_connection.py:4384–4401  ·  view source on GitHub ↗
(node_factory)

Source from the content-addressed store, hash-verified

4382
4383
4384def test_offline(node_factory):
4385 # if get_node starts it, it'll expect an address, so do it manually.
4386 l1 = node_factory.get_node(options={"offline": None}, start=False)
4387 l1.daemon.start()
4388
4389 # we expect it to log offline mode not to listen.
4390 assert l1.daemon.is_in_log("Started in offline mode!")
4391 line = l1.daemon.is_in_log("connectd: Created listener on")
4392 port = re.search(r'connectd: Created listener on 127.0.0.1:(.*)', line).groups()[0]
4393
4394 l2 = node_factory.get_node()
4395
4396 # We cannot connect in!
4397 with pytest.raises(RpcError, match=f"All addresses failed: 127.0.0.1:{port}: Connection establishment: Connection refused."):
4398 l2.rpc.connect(l1.rpc.getinfo()['id'], 'localhost', int(port))
4399
4400 # We *can* connect out
4401 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
4402
4403
4404def test_last_stable_connection(node_factory):

Callers

nothing calls this directly

Calls 5

is_in_logMethod · 0.80
get_nodeMethod · 0.45
startMethod · 0.45
connectMethod · 0.45
getinfoMethod · 0.45

Tested by

no test coverage detected