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

Function test_connect_transient

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

Source from the content-addressed store, hash-verified

4518
4519
4520def test_connect_transient(node_factory):
4521 l1, l2, l3, l4 = node_factory.get_nodes(4, opts={'may_reconnect': True})
4522
4523 # This is not transient, because they have a channel
4524 node_factory.join_nodes([l1, l2])
4525
4526 # Make sure it reconnects once it has a channel.
4527 l1.rpc.disconnect(l2.info['id'], force=True)
4528 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
4529
4530 # This has no channel, and thus is a transient.
4531 l1.rpc.connect(l3.info['id'], 'localhost', l3.port)
4532
4533 l1.rpc.dev_connectd_exhaust_fds()
4534
4535 # Connecting to l4 will discard connection to l3!
4536 l1.rpc.connect(l4.info['id'], 'localhost', l4.port)
4537 assert l1.rpc.listpeers(l3.info['id'])['peers'] == []
4538 assert l1.daemon.is_in_log(fr"due to stress, randomly closing peer {l3.info['id']} \(score 0\)")
4539
4540
4541def test_connect_transient_pending(node_factory, bitcoind, executor):

Callers

nothing calls this directly

Calls 6

get_nodesMethod · 0.80
join_nodesMethod · 0.80
is_in_logMethod · 0.80
disconnectMethod · 0.45
connectMethod · 0.45
listpeersMethod · 0.45

Tested by

no test coverage detected