Browse Source

routing: don't store node_announce unannounced nodes.

We enter nodes in the map when we create channels, but those channels
could be local and unannounced.  This triggered a failure in
test_gossip_persistence since the store truncated when it saw the
first thing was a node_announce.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
4aca909acb
  1. 10
      gossipd/routing.c

10
gossipd/routing.c

@ -1099,6 +1099,14 @@ bool routing_add_node_announcement(struct routing_state *rstate, const u8 *msg T
return true;
}
static bool node_has_public_channels(struct node *node)
{
for (size_t i = 0; i < tal_count(node->chans); i++)
if (node->chans[i]->public)
return true;
return false;
}
u8 *handle_node_announcement(struct routing_state *rstate, const u8 *node_ann)
{
u8 *serialized;
@ -1187,6 +1195,8 @@ u8 *handle_node_announcement(struct routing_state *rstate, const u8 *node_ann)
/* Beyond this point it's not malformed, so safe if we make it
* pending and requeue later. */
node = get_node(rstate, &node_id);
if (node && !node_has_public_channels(node))
node = NULL;
/* Check if we are currently verifying the txout for a
* matching channel */

Loading…
Cancel
Save