Skip to content

Commit

Permalink
pytest: Start of a seeker autoconnect test
Browse files Browse the repository at this point in the history
  • Loading branch information
endothermicdev committed Nov 13, 2024
1 parent e851886 commit bb81f52
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_gossip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2296,3 +2296,21 @@ 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(r'lightningd: attempting connection to '
rf'{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']]

0 comments on commit bb81f52

Please sign in to comment.