Browse Source

gossipd: place limit on pending announcements.

Now we queue them, we should place a limit.  It's not the worst thing in
the world if we discard them (we'll catch up eventually), but we should
try not to in case we're just a bit behind.

Our behaviour here is also O(n^2) so we don't want a massive queue
anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
travis-debug
Rusty Russell 5 years ago
parent
commit
a071a754b3
  1. 14
      gossipd/routing.c

14
gossipd/routing.c

@ -1746,6 +1746,20 @@ u8 *handle_channel_announcement(struct routing_state *rstate,
goto malformed;
}
/* Don't add an infinite number of pending announcements. If we're
* catching up with the bitcoin chain, though, they can definitely
* pile up. */
if (pending_cannouncement_map_count(&rstate->pending_cannouncements)
> 100000) {
static bool warned = false;
if (!warned) {
status_unusual("Flooded by channel_announcements:"
" ignoring some");
warned = true;
}
goto ignored;
}
status_debug("Received channel_announcement for channel %s",
type_to_string(tmpctx, struct short_channel_id,
&pending->short_channel_id));

Loading…
Cancel
Save