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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-08-08 23:36:58 +09:30 committed by Christian Decker
parent e47ac33a37
commit 329270525c
3 changed files with 12 additions and 6 deletions

View File

@ -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:<ephem>
@ -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

View File

@ -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'

View File

@ -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 = [