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

Function reprocess_queued_msgs

gossipd/gossmap_manage.c:1309–1367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1307}
1308
1309static 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 }

Callers 1

Calls 10

map_emptyFunction · 0.85
reprocess_early_cupdatesFunction · 0.85
gossmap_find_nodeFunction · 0.85
query_unknown_nodeFunction · 0.85
bad_gossipFunction · 0.85
fmt_node_idFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected