common: fix `bad cupdates` count in gossmap.c
What changed, and why it matters
This is a one-line logging fix. The code was counting successful channel updates as 'bad' channel updates in a debug log message. The fix flips the boolean so the counter increments only when an update actually fails. It does not change any network behavior, validation rules, or security logic.
No security action needed. Treat as a normal bugfix/logging correction.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In common/gossmap.c, map_catchup() iterates over gossip store messages. For WIRE_CHANNEL_UPDATE messages, it accumulated num_bad_cupdates using update_channel()’s return value directly. update_channel() returns true on success, so the counter was counting good updates as bad. The patch changes the increment to !update_channel(map, off) so only failed updates are counted. This affects only a debug log line and has no functional impact on gossip processing.
Changed components
common/gossmap.cgossipd debug loggingInspect captured patch +1 / −1
diff --git a/common/gossmap.c b/common/gossmap.c
index ce3d5425..78a885fc 100644
--- a/common/gossmap.c
+++ b/common/gossmap.c
@@ -896,7 +896,7 @@ static bool map_catchup(struct gossmap *map,
return false;
map->num_live++;
} else if (type == WIRE_CHANNEL_UPDATE)
- num_bad_cupdates += update_channel(map, off);
+ num_bad_cupdates += !update_channel(map, off);
else if (type == WIRE_GOSSIP_STORE_DELETE_CHAN)
remove_channel_by_deletemsg(map, off);
else if (type == WIRE_NODE_ANNOUNCEMENT)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.