Merge pull request #9084 from morehouse/detect_invalid_timestamp_field
lnwire: detect invalid timestamp field
This commit is contained in:
2 files changed
+6
-6
No files matched your search
@@ -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(
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user