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

Function gossmap_remove_localmods

common/gossmap.c:1336–1364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1334}
1335
1336void gossmap_remove_localmods(struct gossmap *map,
1337 const struct gossmap_localmods *localmods)
1338{
1339 size_t n = tal_count(localmods->mods);
1340
1341 assert(map->local_announces == localmods->local_announces);
1342
1343 for (size_t i = 0; i < n; i++) {
1344 const struct localmod *mod = &localmods->mods[i];
1345 struct gossmap_chan *chan = gossmap_find_chan(map, &mod->scid);
1346
1347 /* If there was no channel, ignore */
1348 if (!chan)
1349 continue;
1350
1351 /* If that's a local channel, remove it now. */
1352 if (chan->cann_off >= map->map_size) {
1353 gossmap_remove_chan(map, chan);
1354 } else {
1355 /* Restore. */
1356 for (size_t h = 0; h < 2; h++) {
1357 chan->half[h] = mod->orig[h];
1358 chan->cupdate_off[h] = mod->orig_cupdate_off[h];
1359 }
1360 }
1361 }
1362 map->local_announces = NULL;
1363 map->local_updates = tal_free(map->local_updates);
1364}
1365
1366bool gossmap_refresh(struct gossmap *map)
1367{

Callers 12

mainFunction · 0.85
path_to_nodeFunction · 0.85
put_gossmapFunction · 0.85
source_free_layerFunction · 0.85
do_getroutesFunction · 0.85
refreshgossmap_cbFunction · 0.85
routehints_doneFunction · 0.85
compute_routes_cbFunction · 0.85
channelfilter_cbFunction · 0.85

Calls 3

gossmap_find_chanFunction · 0.85
gossmap_remove_chanFunction · 0.85
tal_freeFunction · 0.85

Tested by 1

mainFunction · 0.68