| 496 | static void peer_gossip_probe_nannounces(struct seeker *seeker); |
| 497 | |
| 498 | static void nodeannounce_query_done(struct peer *peer, bool complete) |
| 499 | { |
| 500 | struct seeker *seeker = peer->daemon->seeker; |
| 501 | struct routing_state *rstate = seeker->daemon->rstate; |
| 502 | size_t new_nannounce = 0, num_scids; |
| 503 | |
| 504 | /* We might have given up on them, then they replied. */ |
| 505 | if (seeker->random_peer_softref != peer) { |
| 506 | status_peer_debug(&peer->id, "seeker: belated reply: ignoring"); |
| 507 | return; |
| 508 | } |
| 509 | |
| 510 | clear_softref(seeker, &seeker->random_peer_softref); |
| 511 | |
| 512 | num_scids = tal_count(seeker->nannounce_scids); |
| 513 | for (size_t i = 0; i < num_scids; i++) { |
| 514 | struct chan *c = get_channel(rstate, |
| 515 | &seeker->nannounce_scids[i]); |
| 516 | /* Could have closed since we asked. */ |
| 517 | if (!c) |
| 518 | continue; |
| 519 | if ((seeker->nannounce_query_flags[i] & SCID_QF_NODE1) |
| 520 | && c->nodes[0]->bcast.index) |
| 521 | new_nannounce++; |
| 522 | if ((seeker->nannounce_query_flags[i] & SCID_QF_NODE2) |
| 523 | && c->nodes[1]->bcast.index) |
| 524 | new_nannounce++; |
| 525 | } |
| 526 | |
| 527 | status_peer_debug(&peer->id, |
| 528 | "seeker: found %zu new node_announcements in %zu scids", |
| 529 | new_nannounce, num_scids); |
| 530 | |
| 531 | seeker->nannounce_scids = tal_free(seeker->nannounce_scids); |
| 532 | seeker->nannounce_query_flags = tal_free(seeker->nannounce_query_flags); |
| 533 | |
| 534 | if (!new_nannounce) { |
| 535 | set_state(seeker, NORMAL, NULL, |
| 536 | "No new node_announcements in %zu scids", num_scids); |
| 537 | return; |
| 538 | } |
| 539 | |
| 540 | /* Since they told us about new announcements, keep asking them. */ |
| 541 | set_preferred_peer(seeker, peer); |
| 542 | |
| 543 | /* Double every time. We may skip a few, of course, since map |
| 544 | * is changing. */ |
| 545 | num_scids *= 2; |
| 546 | /* Don't try to create a query larger than 64k */ |
| 547 | if (num_scids > 7000) |
| 548 | num_scids = 7000; |
| 549 | |
| 550 | if (!get_unannounced_nodes(seeker, seeker->daemon->rstate, num_scids, |
| 551 | &seeker->nannounce_scids, |
| 552 | &seeker->nannounce_query_flags)) { |
| 553 | /* Nothing unknown at all? Great, we're done */ |
| 554 | set_state(seeker, NORMAL, NULL, "No unannounced nodes"); |
| 555 | return; |
nothing calls this directly
no test coverage detected