From 329270525cfceebb6f0dd6b9806fbd1cfc9d6290 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 8 Aug 2018 23:36:58 +0930 Subject: [PATCH] pytest: only use dev-allow-localhost when needed. The next patches get better at reconecting, so if we use dev-allow-localhost nodes can often find each other and reconnect before shutting down; only use that option where we actually need it. Signed-off-by: Rusty Russell --- tests/test_gossip.py | 8 ++++++-- tests/test_misc.py | 8 ++++++-- tests/utils.py | 2 -- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/test_gossip.py b/tests/test_gossip.py index 15d0e6579..67dabc73a 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -112,7 +112,8 @@ def test_announce_address(node_factory, bitcoind): 'silkroad6ownowfk.onion', '1.2.3.4:1234', '::'], - 'log-level': 'io'} + 'log-level': 'io', + 'dev-allow-localhost': None} l1, l2 = node_factory.get_nodes(2, opts=[opts, {}]) # It should warn about the collision between --addr=127.0.0.1: @@ -217,7 +218,10 @@ def test_gossip_timestamp_filter(node_factory, bitcoind): def test_connect_by_gossip(node_factory, bitcoind): """Test connecting to an unknown peer using node gossip """ - l1, l2, l3 = node_factory.get_nodes(3) + l1, l2, l3 = node_factory.get_nodes(3, + opts=[{'dev-allow-localhost': None}, + {}, + {'dev-allow-localhost': None}]) l2.rpc.connect(l3.info['id'], 'localhost', l3.port) # Nodes are gossiped only if they have channels diff --git a/tests/test_misc.py b/tests/test_misc.py index 94343bf6d..21968dcb4 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -538,9 +538,13 @@ def test_io_logging(node_factory, executor): def test_address(node_factory): - l1 = node_factory.get_node() + if DEVELOPER: + opts = {'dev-allow-localhost': None} + else: + opts = None + l1 = node_factory.get_node(options=opts) addr = l1.rpc.getinfo()['address'] - if 'dev-allow-localhost' in l1.daemon.opts: + if DEVELOPER: assert len(addr) == 1 assert addr[0]['type'] == 'ipv4' assert addr[0]['address'] == '127.0.0.1' diff --git a/tests/utils.py b/tests/utils.py index 9e797fe4d..5a104dd8f 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -317,8 +317,6 @@ class LightningD(TailableProc): if DEVELOPER: self.opts['dev-broadcast-interval'] = 1000 self.opts['dev-bitcoind-poll'] = 1 - # lightningd won't announce non-routable addresses by default. - self.opts['dev-allow-localhost'] = None self.prefix = 'lightningd-%d' % (node_id) filters = [