Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions gossipd/gossipd.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,11 @@ void tell_lightningd_peer_update(struct daemon *daemon,
{
struct peer_update remote_update;
u8* msg;

/* FIXME: Tell connectd to kick out source peer if this happens? */
if (daemon_conn_queue_length(daemon->master) > 10000)
return;

remote_update.scid = scid;
remote_update.fee_base = fee_base_msat;
remote_update.fee_ppm = fee_ppm;
Expand Down
13 changes: 12 additions & 1 deletion gossipd/seeker.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ struct seeker {

/* Channels we've heard about, but don't know (by scid). */
UINTMAP(bool) unknown_scids;
size_t num_unknown_scids;

/* Channels we've heard about newer timestamps for (by scid). u8 is
* query_flags. */
Expand Down Expand Up @@ -150,6 +151,7 @@ struct seeker *new_seeker(struct daemon *daemon)

seeker->daemon = daemon;
uintmap_init(&seeker->unknown_scids);
seeker->num_unknown_scids = 0;
uintmap_init(&seeker->stale_scids);
seeker->random_peer = NULL;
u32 gossipers = daemon->autoconnect_seeker_peers > SEEKER_GOSSIPERS ?
Expand Down Expand Up @@ -300,6 +302,7 @@ static struct short_channel_id *unknown_scids_remove(const tal_t *ctx,
while (uintmap_first(&seeker->unknown_scids, &scid)) {
scids[i].u64 = scid;
(void)uintmap_del(&seeker->unknown_scids, scid);
seeker->num_unknown_scids--;
if (++i == max)
break;
}
Expand Down Expand Up @@ -689,10 +692,15 @@ static bool add_unknown_scid(struct seeker *seeker,
struct short_channel_id scid,
struct peer *peer)
{
/* We can't know everything! */
if (seeker->num_unknown_scids > 10000)
return false;

/* Check we're not already getting this one. */
if (!uintmap_add(&seeker->unknown_scids, scid.u64, true))
return false;

seeker->num_unknown_scids++;
set_preferred_peer(seeker, peer);
return true;
}
Expand Down Expand Up @@ -1145,7 +1153,10 @@ bool remove_unknown_scid(struct seeker *seeker,
const struct short_channel_id *scid,
bool found /*FIXME: use this info!*/)
{
return uintmap_del(&seeker->unknown_scids, scid->u64);
if (!uintmap_del(&seeker->unknown_scids, scid->u64))
return false;
seeker->num_unknown_scids--;
return true;
}

/* This peer told us about an update to an unknown channel. Ask it for a
Expand Down
Loading