More flexible address wildcards, only add wildcard if nothing else.

1. Add special option where an empty host means 'wildcard for IPv4 and/or IPv6'
   which means ':1234' can be used to set only the portnum.
2. Only add this protocol wildcard if --autolisten=1 (default)
   and no other addresses specified.
3. Pass it down to gossipd, so it can handle errors correctly: in most cases,
   it's fatal not to be able to bind to a port, but for this case, it's OK
   if we can only bind to one of IPv4/v6 (fatal iff neither).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-05-07 13:59:22 +09:30
committed by Christian Decker
parent 73cd009a4c
commit 52917ff6c9
10 changed files with 108 additions and 41 deletions

View File

@@ -4281,6 +4281,13 @@ class LightningDTests(BaseLightningDTests):
bitcoind.generate_block(1)
l1.daemon.wait_for_log('ONCHAIN')
def test_address(self):
l1 = self.node_factory.get_node()
assert len(l1.rpc.getinfo()['address']) == 1
assert l1.rpc.getinfo()['address'][0]['type'] == 'ipv4'
assert l1.rpc.getinfo()['address'][0]['address'] == '127.0.0.1'
assert int(l1.rpc.getinfo()['address'][0]['port']) == l1.port
def test_listconfigs(self):
l1 = self.node_factory.get_node()