| 1334 | } |
| 1335 | |
| 1336 | void 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 | |
| 1366 | bool gossmap_refresh(struct gossmap *map) |
| 1367 | { |