Skip to content

Commit

Permalink
pyln-testing: disable seeker autoconnect by default
Browse files Browse the repository at this point in the history
This avoids test flakes, but can be explicitly set if needed.

Changelog-None
  • Loading branch information
endothermicdev authored and rustyrussell committed Nov 24, 2024
1 parent c596550 commit 11580df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions contrib/pyln-testing/pyln/testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,8 @@ def __init__(self, node_id, lightning_dir, bitcoind, executor, valgrind, may_fai
self.daemon.opts["experimental-dual-fund"] = None
if EXPERIMENTAL_SPLICING:
self.daemon.opts["experimental-splicing"] = None
# Avoid test flakes cause by this option unless explicitly set.
self.daemon.opts.update({"autoconnect-seeker-peers": 0})

if options is not None:
self.daemon.opts.update(options)
Expand Down
11 changes: 6 additions & 5 deletions tests/test_gossip.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def test_gossip_pruning(node_factory, bitcoind):
""" Create channel and see it being updated in time before pruning
"""
l1, l2, l3 = node_factory.get_nodes(3, opts={'dev-fast-gossip-prune': None,
'allow_bad_gossip': True})
'allow_bad_gossip': True,
'autoconnect-seeker-peers': 0})

l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
Expand Down Expand Up @@ -2336,21 +2337,21 @@ def test_gossip_seeker_autoconnect(node_factory):
necessary."""

port = node_factory.get_unused_port()
opts = [{'autoconnect-seeker-peers': 0, 'may_reconnect': True},
opts = [{'may_reconnect': True,
'autoconnect-seeker-peers': 0},
{'may_reconnect': True},
{'bind-addr': f'127.0.0.1:{port}',
'announce-addr': f'127.0.0.1:{port}'}]
l1, l2, l3 = node_factory.line_graph(3, opts=opts, wait_for_announce=True)
l2.daemon.wait_for_log('gossipd: seeker: need more peers for gossip')
time.sleep(1)
l1.daemon.wait_for_log('seeker: chosen for periodic full sync')
time.sleep(10)
# The seeker wants more peers, but l1 should not autoconnect due to option.
assert not l1.daemon.is_in_log(r'lightningd: attempting connection to ')

# Try again with default settings.
del l1.daemon.opts['autoconnect-seeker-peers']
l1.restart()
# L1 and L3 should autoconnect with valid node announcement connection addresses.
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')
Expand Down

0 comments on commit 11580df

Please sign in to comment.