(node_factory)
| 4518 | |
| 4519 | |
| 4520 | def 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 | |
| 4541 | def test_connect_transient_pending(node_factory, bitcoind, executor): |
nothing calls this directly
no test coverage detected