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 authored and cdecker committed Feb 12, 2024
1 parent e7f1f29 commit c6ef044
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 @@ -509,9 +509,14 @@ u64 gossip_store_set_flag(struct gossip_store *gs,
if (!check_msg_type(gs, offset, flag, type, &hdr))
return offset;

assert((be16_to_cpu(hdr.flags) & flag) == 0);
if (be16_to_cpu(hdr.flags) & flag) {
status_broken("gossip_store flag-%u @%"PRIu64" for %u already set!",
flag, offset, type);
}

hdr.flags |= cpu_to_be16(flag);
if (pwrite(gs->fd, &hdr, sizeof(hdr), offset - sizeof(hdr)) != sizeof(hdr))

status_failed(STATUS_FAIL_INTERNAL_ERROR,
"Failed writing set flags @%"PRIu64": %s",
offset, strerror(errno));
Expand Down

0 comments on commit c6ef044

Please sign in to comment.