Merge pull request #9084 from morehouse/detect_invalid_timestamp_field

lnwire: detect invalid timestamp field
This commit is contained in:
Oliver Gugger authored and GitHub committed 2024-09-11 03:31:01 -06:00
commit a518f7dfbc
2 files changed
+6 -6

No files matched your search

-6
View File
@@ -835,12 +835,6 @@ func (g *GossipSyncer) processChanRangeReply(msg *lnwire.ReplyChannelRange) erro
}
g.prevReplyChannelRange = msg
if len(msg.Timestamps) != 0 &&
len(msg.Timestamps) != len(msg.ShortChanIDs) {
return fmt.Errorf("number of timestamps not equal to " +
"number of SCIDs")
}
for i, scid := range msg.ShortChanIDs {
info := channeldb.NewChannelUpdateInfo(
+6
View File
@@ -104,6 +104,12 @@ func (c *ReplyChannelRange) Decode(r io.Reader, pver uint32) error {
// Set the corresponding TLV types if they were included in the stream.
if val, ok := typeMap[TimestampsRecordType]; ok && val == nil {
c.Timestamps = timeStamps
// Check that a timestamp was provided for each SCID.
if len(c.Timestamps) != len(c.ShortChanIDs) {
return fmt.Errorf("number of timestamps does not " +
"match number of SCIDs")
}
}
if len(tlvRecords) != 0 {