mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 09:40:19 +01:00
gossipd: exclude early blocks from random probes.
When probing, no point probing for before lightning became cool. Current logic means we often probe below block 500,000, and think things are OK because there are no short_channel_ids. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
be49a599bc
commit
79df507442
1 changed files with 13 additions and 3 deletions
|
@ -717,13 +717,23 @@ static void peer_gossip_probe_scids(struct seeker *seeker)
|
|||
|
||||
static void probe_random_scids(struct seeker *seeker, size_t num_blocks)
|
||||
{
|
||||
if (seeker->daemon->current_blockheight < num_blocks) {
|
||||
u32 avail_blocks;
|
||||
|
||||
/* Ignore early blocks (unless we're before, which would be weird) */
|
||||
if (seeker->daemon->current_blockheight
|
||||
< chainparams->when_lightning_became_cool)
|
||||
avail_blocks = seeker->daemon->current_blockheight;
|
||||
else
|
||||
avail_blocks = seeker->daemon->current_blockheight
|
||||
- chainparams->when_lightning_became_cool;
|
||||
|
||||
if (avail_blocks < num_blocks) {
|
||||
seeker->scid_probe_start = 0;
|
||||
seeker->scid_probe_end = seeker->daemon->current_blockheight;
|
||||
} else {
|
||||
seeker->scid_probe_start
|
||||
= pseudorand(seeker->daemon->current_blockheight
|
||||
- num_blocks);
|
||||
= chainparams->when_lightning_became_cool
|
||||
+ pseudorand(avail_blocks - num_blocks);
|
||||
seeker->scid_probe_end
|
||||
= seeker->scid_probe_start + num_blocks - 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue