diff --git a/discovery/syncer.go b/discovery/syncer.go index b6adb447a6d..cdb041d99bd 100644 --- a/discovery/syncer.go +++ b/discovery/syncer.go @@ -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( diff --git a/lnwire/reply_channel_range.go b/lnwire/reply_channel_range.go index ea45a5843ce..591fc2bd60b 100644 --- a/lnwire/reply_channel_range.go +++ b/lnwire/reply_channel_range.go @@ -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 {