| 1307 | } |
| 1308 | |
| 1309 | static void reprocess_queued_msgs(struct gossmap_manage *gm) |
| 1310 | { |
| 1311 | bool pending_ann_empty, early_ann_empty; |
| 1312 | |
| 1313 | pending_ann_empty = map_empty(&gm->pending_ann_map); |
| 1314 | early_ann_empty = map_empty(&gm->early_ann_map); |
| 1315 | |
| 1316 | if (pending_ann_empty) { |
| 1317 | reprocess_pending_cupdates(gm); |
| 1318 | /* This should have been final! */ |
| 1319 | assert(map_empty(&gm->pending_ann_map)); |
| 1320 | } |
| 1321 | |
| 1322 | if (early_ann_empty) { |
| 1323 | /* reprocess_pending_cupdates should not have added any! */ |
| 1324 | assert(map_empty(&gm->early_ann_map)); |
| 1325 | reprocess_early_cupdates(gm); |
| 1326 | /* Won't add any more */ |
| 1327 | assert(map_empty(&gm->early_ann_map)); |
| 1328 | } |
| 1329 | |
| 1330 | /* Nothing at all outstanding? All node_announcements can now be processed */ |
| 1331 | if (early_ann_empty && pending_ann_empty) { |
| 1332 | struct pending_nannounce **pnas = gm->pending_nannounces; |
| 1333 | |
| 1334 | gm->pending_nannounces = tal_arr(gm, struct pending_nannounce *, 0); |
| 1335 | |
| 1336 | for (size_t i = 0; i < tal_count(pnas); i++) { |
| 1337 | struct gossmap_node *node; |
| 1338 | struct gossmap *gossmap = gossmap_manage_get_gossmap(gm); |
| 1339 | |
| 1340 | node = gossmap_find_node(gossmap, &pnas[i]->node_id); |
| 1341 | if (!node) { |
| 1342 | /* Seeker may want to ask about this. */ |
| 1343 | query_unknown_node(gm->daemon, |
| 1344 | pnas[i]->source_peer, &pnas[i]->node_id); |
| 1345 | |
| 1346 | /* Don't complain to them: this can happen. */ |
| 1347 | bad_gossip(pnas[i]->source_peer, |
| 1348 | tal_fmt(tmpctx, |
| 1349 | "node_announcement: unknown node %s", |
| 1350 | fmt_node_id(tmpctx, &pnas[i]->node_id))); |
| 1351 | continue; |
| 1352 | } |
| 1353 | |
| 1354 | process_node_announcement(gm, gossmap, node, |
| 1355 | pnas[i]->timestamp, |
| 1356 | &pnas[i]->node_id, |
| 1357 | pnas[i]->nannounce, |
| 1358 | pnas[i]->source_peer); |
| 1359 | } |
| 1360 | |
| 1361 | /* Won't add any new ones */ |
| 1362 | assert(map_empty(&gm->pending_ann_map)); |
| 1363 | assert(map_empty(&gm->early_ann_map)); |
| 1364 | |
| 1365 | tal_free(pnas); |
| 1366 | } |
no test coverage detected