Skip to content

Commit 6b91497

Browse files
rustyrussellvincenzopalazzo
authored andcommitted
common: make gossmap ignore redundant channel_announcements.
This seems to be happening to some people, so don't panic. Unfortunately we don't have a good error callback here, so msg to stderr. Fixes: #7249 Signed-off-by: Rusty Russell <[email protected]>
1 parent 744116e commit 6b91497

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

common/gossmap.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,16 @@ static struct gossmap_chan *add_channel(struct gossmap *map,
458458
map_nodeid(map, cannounce_off + plus_scid_off + 8, &node_id[0]);
459459
map_nodeid(map, cannounce_off + plus_scid_off + 8 + PUBKEY_CMPR_LEN, &node_id[1]);
460460

461-
/* We 1should not get duplicates. */
461+
/* We should not get duplicates. */
462462
scid.u64 = map_be64(map, cannounce_off + plus_scid_off);
463-
assert(!gossmap_find_chan(map, &scid));
463+
chan = gossmap_find_chan(map, &scid);
464+
if (chan) {
465+
/* FIXME: Report this better! */
466+
warnx("gossmap: redundant channel_announce for %s, offsets %u and %zu!",
467+
fmt_short_channel_id(tmpctx, scid),
468+
chan->cann_off, cannounce_off);
469+
return NULL;
470+
}
464471

465472
/* We carefully map pointers to indexes, since new_node can move them! */
466473
n[0] = gossmap_find_node(map, &node_id[0]);

0 commit comments

Comments
 (0)