| 702 | } |
| 703 | |
| 704 | static 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 */ |
| 732 | static void probe_some_random_scids(struct seeker *seeker) |
no test coverage detected