From caca9aa405addbbf51f3bced516c5310c8baac11 Mon Sep 17 00:00:00 2001 From: Alex Myers Date: Wed, 6 Nov 2024 17:28:26 -0600 Subject: [PATCH] pytest: Start of a seeker autoconnect test --- tests/test_gossip.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_gossip.py b/tests/test_gossip.py index d0a911b439c3..6ff56ffe5b5d 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -2295,3 +2295,19 @@ def test_gossip_force_broadcast_channel_msgs(node_factory, bitcoind): 'channel_update': 3, 'node_announce': 1, 'gossip_filter': 1} + + +def test_gossip_seeker_autoconnect(node_factory): + """Seeker should connect to additional peers and initiate connections if + necessary.""" + + port = node_factory.get_unused_port() + opts = [{}, {}, {'bind-addr': f'127.0.0.1:{port}','announce-addr': f'127.0.0.1:{port}'}] + # l1, l2 = node_factory.get_nodes(2) + l1, l2, l3 = node_factory.line_graph(3, opts=opts, wait_for_announce=True) + # L1 and L3 should autoconnect with valid node announcement connection addresses + # Wait for seeker to decide to autoconnect + l1.daemon.wait_for_log('gossipd: seeker: need more peers for gossip') + l1.daemon.wait_for_log(rf'lightningd: attempting connection to {l3.info["id"]} for additional gossip') + l1.daemon.wait_for_log('gossipd: seeker: starting gossip') + assert l3.info['id'] in [n['id'] for n in l1.rpc.listpeers()['peers']]