From 11580dfd43960b4c7b7a2b4ffc1759252bf797cd Mon Sep 17 00:00:00 2001 From: Alex Myers Date: Sat, 23 Nov 2024 10:52:02 -0600 Subject: [PATCH] pyln-testing: disable seeker autoconnect by default This avoids test flakes, but can be explicitly set if needed. Changelog-None --- contrib/pyln-testing/pyln/testing/utils.py | 2 ++ tests/test_gossip.py | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py index d3bd249e8b44..c65c073b58b6 100644 --- a/contrib/pyln-testing/pyln/testing/utils.py +++ b/contrib/pyln-testing/pyln/testing/utils.py @@ -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) diff --git a/tests/test_gossip.py b/tests/test_gossip.py index 5ad62b77ef7d..f9b4ecc2b3a7 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -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) @@ -2336,13 +2337,14 @@ 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 ') @@ -2350,7 +2352,6 @@ def test_gossip_seeker_autoconnect(node_factory): 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')