Browse Source

gossipd: fix corner case where gossip msg too old after pending delay.

Happened under Travis with --dev-fast-gossip (90 second prune time), but can
happen anyway if gossip is almost 2 weeks old when we receive it:

2019-09-20T19:16:51.367Z DEBUG lightning_gossipd(20972): Received node_announcement for node 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59
2019-09-20T19:16:51.376Z DEBUG lightning_gossipd(20972): Ignoring node_announcement timestamp 1569006918 for 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59
2019-09-20T19:16:51.669Z **BROKEN** lightning_gossipd(20972): pending node_announcement 01013094af771d60f4de69bb39ce045e4edf4a06fe6c80078dfa4fab58ab5617d6ad4fa34b6d3437380db0a8293cea348bbc77f714ef71fcd8515bfc82336667441f00005d852546022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59022d2253494c454e544152544953542d633961313734610000000000000000000000000000 malformed? (version c9a174a)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
travis-debug
Rusty Russell 5 years ago
committed by Christian Decker
parent
commit
b55ff34f93
  1. 21
      gossipd/routing.c

21
gossipd/routing.c

@ -1454,13 +1454,12 @@ static void process_pending_node_announcement(struct routing_state *rstate,
"Processing deferred node_announcement for node %s",
type_to_string(pna, struct node_id, nodeid));
/* Should not error, since we processed it before */
/* Can fail it timestamp is now too old */
if (!routing_add_node_announcement(rstate,
pna->node_announcement,
pna->index))
status_failed(STATUS_FAIL_INTERNAL_ERROR,
"pending node_announcement %s malformed?",
tal_hex(tmpctx, pna->node_announcement));
status_unusual("pending node_announcement %s too old?",
tal_hex(tmpctx, pna->node_announcement));
/* Never send this again. */
pna->node_announcement = tal_free(pna->node_announcement);
}
@ -1836,13 +1835,15 @@ bool handle_pending_cannouncement(struct routing_state *rstate,
pending_cannouncement_map_del(&rstate->pending_cannouncements, pending);
tal_del_destructor2(pending, destroy_pending_cannouncement, rstate);
/* Can fail if channel_announcement too old */
if (!routing_add_channel_announcement(rstate, pending->announce, sat, 0))
status_failed(STATUS_FAIL_INTERNAL_ERROR,
"Could not add channel_announcement");
/* Did we have an update waiting? If so, apply now. */
process_pending_channel_update(rstate, scid, pending->updates[0]);
process_pending_channel_update(rstate, scid, pending->updates[1]);
status_unusual("Could not add channel_announcement %s: too old?",
tal_hex(tmpctx, pending->announce));
else {
/* Did we have an update waiting? If so, apply now. */
process_pending_channel_update(rstate, scid, pending->updates[0]);
process_pending_channel_update(rstate, scid, pending->updates[1]);
}
tal_free(pending);
return true;

Loading…
Cancel
Save