discovery: enforce non-zero timestamp in gossip messages

In this commit, we add validation for channel updates and node
announcements to ensure that we reject gossip messages with zero
timestamps at the discovery layer.

From BOLT 7:
  "MUST set timestamp to greater than 0, AND to greater than any
  previously-sent channel_update for this short_channel_id."

This validation is performed in the gossip handlers (handleNodeAnnouncement
and handleChanUpdate) rather than at the wire protocol level. This approach
ensures we can still decode messages from disk or embedded in onion errors
while rejecting invalid gossip from peers.

Remote peers sending zero-timestamp gossip will have their ban score
incremented.
This commit is contained in:
Olaoluwa Osuntokun committed 2026-01-09 17:10:37 -08:00
1 parent eea4840086
commit cad1b957bf
3 files changed
+115

No files matched your search

@@ -103,6 +103,12 @@
# Technical and Architectural Updates
## BOLT Spec Updates
* [Enforce non-zero timestamps](https://github.com/lightningnetwork/lnd/pull/10469)
for `channel_update` (as required by BOLT 7) and `node_announcement` messages.
Gossip messages with zero timestamps are now rejected. For `channel_update`
messages, remote peers sending such invalid messages will have their ban score
incremented.
## Testing
## Database