gossipd: don't try to connect to non-routable addresses.

Someone could try to announce an internal address, and we might probe
it.

This breaks tests, so we add '--dev-allow-localhost' for our tests, so
we don't eliminate that one.  Of course, now we need to skip some more
tests in non-developer mode.

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 af065417e1
commit d40d22b68e
16 changed files with 66 additions and 38 deletions

View File

@@ -86,7 +86,8 @@ static struct node_map *empty_node_map(const tal_t *ctx)
struct routing_state *new_routing_state(const tal_t *ctx,
const struct bitcoin_blkid *chain_hash,
const struct pubkey *local_id,
u32 prune_timeout)
u32 prune_timeout,
bool dev_allow_localhost)
{
struct routing_state *rstate = tal(ctx, struct routing_state);
rstate->nodes = empty_node_map(rstate);
@@ -95,6 +96,7 @@ struct routing_state *new_routing_state(const tal_t *ctx,
rstate->local_id = *local_id;
rstate->prune_timeout = prune_timeout;
rstate->store = gossip_store_new(rstate);
rstate->dev_allow_localhost = dev_allow_localhost;
list_head_init(&rstate->pending_cannouncement);
uintmap_init(&rstate->chanmap);