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