Skip to content

Commit f2243e6

Browse files
endothermicdevrustyrussell
authored andcommitted
pytest: Add seeker autoconnect test
1 parent dff5c89 commit f2243e6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_gossip.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,3 +2328,21 @@ def test_gossip_force_broadcast_channel_msgs(node_factory, bitcoind):
23282328
assert tally == {'channel_announce': 1,
23292329
'channel_update': 3,
23302330
'node_announce': 1}
2331+
2332+
2333+
def test_gossip_seeker_autoconnect(node_factory):
2334+
"""Seeker should connect to additional peers and initiate connections if
2335+
necessary."""
2336+
2337+
port = node_factory.get_unused_port()
2338+
opts = [{}, {}, {'bind-addr': f'127.0.0.1:{port}',
2339+
'announce-addr': f'127.0.0.1:{port}'}]
2340+
# l1, l2 = node_factory.get_nodes(2)
2341+
l1, l2, l3 = node_factory.line_graph(3, opts=opts, wait_for_announce=True)
2342+
# L1 and L3 should autoconnect with valid node announcement connection addresses
2343+
# Wait for seeker to decide to autoconnect
2344+
l1.daemon.wait_for_log('gossipd: seeker: need more peers for gossip')
2345+
l1.daemon.wait_for_log(r'lightningd: attempting connection to '
2346+
rf'{l3.info["id"]} for additional gossip')
2347+
l1.daemon.wait_for_log('gossipd: seeker: starting gossip')
2348+
assert l3.info['id'] in [n['id'] for n in l1.rpc.listpeers()['peers']]

0 commit comments

Comments
 (0)