From 4b33b50625ed18fc3f31dbd68d3dff3ce7686ec5 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 18 Oct 2019 20:42:54 +1030 Subject: [PATCH] gossipd: ask a peer for *every* channel it knows on startup. Asking for the last few blocks was logical, but my node is missing most gossip in practice. For the moment, simply ask a peer for every channel it knows, once we're started up. Signed-off-by: Rusty Russell --- gossipd/seeker.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/gossipd/seeker.c b/gossipd/seeker.c index 1d2af98da..334257543 100644 --- a/gossipd/seeker.c +++ b/gossipd/seeker.c @@ -755,8 +755,6 @@ static void probe_many_random_scids(struct seeker *seeker) static void check_firstpeer(struct seeker *seeker) { - struct chan *c; - u64 index; struct peer *peer = seeker->random_peer_softref, *p; /* It might have died, pick another. */ @@ -787,14 +785,11 @@ static void check_firstpeer(struct seeker *seeker) normal_gossip_start(seeker, p); } - /* We always look up 6 prior to last we have */ - c = uintmap_last(&seeker->daemon->rstate->chanmap, &index); - if (c && short_channel_id_blocknum(&c->scid) > 6) { - seeker->scid_probe_start = short_channel_id_blocknum(&c->scid) - 6; - } else { - seeker->scid_probe_start = 0; - } + /* Ask a random peer for all channels, in case we're missing */ + seeker->scid_probe_start = chainparams->when_lightning_became_cool; seeker->scid_probe_end = seeker->daemon->current_blockheight; + if (seeker->scid_probe_start > seeker->scid_probe_end) + seeker->scid_probe_start = 0; peer_gossip_probe_scids(seeker); }