Skip to content

Commit

Permalink
gossipd: don't assert on redundant flag write, just log message.
Browse files Browse the repository at this point in the history
This happens to Vincenzo, and I think it's due to previous gossip_store issues.

Fixes: ElementsProject#7051
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Feb 10, 2024
1 parent 1e023a1 commit 300ca9e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gossipd/gossip_store.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,12 @@ u64 gossip_store_set_flag(struct gossip_store *gs,
if (!check_msg_type(gs, offset, flag, type))
return offset;

assert((be16_to_cpu(hdr.beflags) & flag) == 0);
/* This can happen due to bugs in prior versions! */
if (be16_to_cpu(hdr.beflags) & flag) {
status_broken("gossip_store flag-%u @%"PRIu64" for %u already set!",
flag, hdr_off, type);
}

hdr.beflags |= cpu_to_be16(flag);
if (pwrite(gs->fd, &hdr.beflags, sizeof(hdr.beflags), hdr_off) != sizeof(hdr.beflags))
status_failed(STATUS_FAIL_INTERNAL_ERROR,
Expand Down

0 comments on commit 300ca9e

Please sign in to comment.