gossipd: don't assert on redundant flag write, just log message.

This happens to Vincenzo, and I think it's due to previous gossip_store issues.

Fixes: https://github.com/ElementsProject/lightning/issues/7051
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-02-10 10:44:52 +10:30 committed by Christian Decker
parent e7f1f29dbd
commit 1350194698

View file

@ -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));