MCPcopy Create free account
hub / github.com/ElementsProject/lightning / probe_random_scids

Function probe_random_scids

gossipd/seeker.c:704–729  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

702}
703
704static void probe_random_scids(struct seeker *seeker, size_t num_blocks)
705{
706 u32 avail_blocks;
707
708 /* Ignore early blocks (unless we're before, which would be weird) */
709 if (seeker->daemon->current_blockheight
710 < chainparams->when_lightning_became_cool)
711 avail_blocks = seeker->daemon->current_blockheight;
712 else
713 avail_blocks = seeker->daemon->current_blockheight
714 - chainparams->when_lightning_became_cool;
715
716 if (avail_blocks < num_blocks) {
717 seeker->scid_probe_start = 0;
718 seeker->scid_probe_end = seeker->daemon->current_blockheight;
719 } else {
720 seeker->scid_probe_start
721 = chainparams->when_lightning_became_cool
722 + pseudorand(avail_blocks - num_blocks);
723 seeker->scid_probe_end
724 = seeker->scid_probe_start + num_blocks - 1;
725 }
726
727 seeker->nannounce_scids = NULL;
728 peer_gossip_probe_scids(seeker);
729}
730
731/* We usually get a channel per block, so these cover a fair bit of ground */
732static void probe_some_random_scids(struct seeker *seeker)

Callers 2

probe_some_random_scidsFunction · 0.85
probe_many_random_scidsFunction · 0.85

Calls 2

peer_gossip_probe_scidsFunction · 0.85
pseudorandFunction · 0.50

Tested by

no test coverage detected