lnwire: validate that gossip messages contain valid TLV

In this commit, we check that the extra bytes appended to gossip
messages contain valid TLV streams. We do this here for:
- channel_announcement
- channel_announcement_2
- channel_update
- channel_update_2
- node_announcement

This is in preparation for the SQL version of the graph store which will
normalise TLV streams at persistence time.
This commit is contained in:
Elle Mouton
2025-05-07 10:36:05 +02:00
parent 0db91304cf
commit 1410a0949d
7 changed files with 47 additions and 9 deletions

View File

@@ -154,7 +154,7 @@ func (c *ChannelUpdate2) DecodeTLVRecords(r io.Reader) error {
c.ExtraOpaqueData = tlvRecords
}
return nil
return c.ExtraOpaqueData.ValidateTLV()
}
// Encode serializes the target ChannelUpdate2 into the passed io.Writer