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

Function reprocess_queued_msgs

gossipd/gossmap_manage.c:1313–1371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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