| 740 | } |
| 741 | |
| 742 | static void check_firstpeer(struct seeker *seeker) |
| 743 | { |
| 744 | struct peer *peer = seeker->random_peer_softref, *p; |
| 745 | |
| 746 | /* It might have died, pick another. */ |
| 747 | if (!peer) { |
| 748 | peer = random_seeker(seeker, peer_has_gossip_queries); |
| 749 | /* No peer? Wait for a new one to join. */ |
| 750 | if (!peer) { |
| 751 | status_debug("seeker: no peers, waiting"); |
| 752 | return; |
| 753 | } |
| 754 | |
| 755 | peer_gossip_startup(seeker, peer); |
| 756 | return; |
| 757 | } |
| 758 | |
| 759 | /* If no progress, we assume it's finished, and if it hasn't, |
| 760 | * we'll end up querying backwards in next steps. */ |
| 761 | if (peer_made_progress(seeker)) |
| 762 | return; |
| 763 | |
| 764 | /* Other peers can gossip now. */ |
| 765 | status_peer_debug(&peer->id, "seeker: startup peer finished"); |
| 766 | clear_softref(seeker, &seeker->random_peer_softref); |
| 767 | list_for_each(&seeker->daemon->peers, p, list) { |
| 768 | if (p == peer) |
| 769 | continue; |
| 770 | |
| 771 | normal_gossip_start(seeker, p); |
| 772 | } |
| 773 | |
| 774 | /* Ask a random peer for all channels, in case we're missing */ |
| 775 | seeker->scid_probe_start = chainparams->when_lightning_became_cool; |
| 776 | seeker->scid_probe_end = seeker->daemon->current_blockheight; |
| 777 | if (seeker->scid_probe_start > seeker->scid_probe_end) |
| 778 | seeker->scid_probe_start = 0; |
| 779 | peer_gossip_probe_scids(seeker); |
| 780 | } |
| 781 | |
| 782 | static void check_probe(struct seeker *seeker, |
| 783 | void (*restart)(struct seeker *seeker)) |
no test coverage detected