multi: fix time.Time initialization.
ChanUpdate timestamps are now restircted so that they cannot be more than two weeks into the future. Moreover channels with both timestamps in the ReplyChannelRange msg either too far in the past or too far in the future are not queried. Moreover fix unitests.
This commit is contained in:
5 files changed
+208
-38
No files matched your search
@@ -2745,6 +2745,22 @@ func (d *AuthenticatedGossiper) handleChanUpdate(nMsg *networkMsg,
|
||||
return nil, true
|
||||
}
|
||||
|
||||
// Check that the ChanUpdate is not too far into the future, this could
|
||||
// reveal some faulty implementation therefore we log an error.
|
||||
if time.Until(timestamp) > graph.DefaultChannelPruneExpiry {
|
||||
log.Errorf("Skewed timestamp (%v) for edge policy of "+
|
||||
"short_chan_id(%v), timestamp too far in the future: "+
|
||||
"peer=%v, msg=%s, is_remote=%v", timestamp.Unix(),
|
||||
shortChanID, nMsg.peer, nMsg.msg.MsgType(),
|
||||
nMsg.isRemote,
|
||||
)
|
||||
|
||||
nMsg.err <- fmt.Errorf("skewed timestamp of edge policy, "+
|
||||
"timestamp too far in the future: %v", timestamp.Unix())
|
||||
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// Get the node pub key as far since we don't have it in the channel
|
||||
// update announcement message. We'll need this to properly verify the
|
||||
// message's signature.
|
||||
|
||||
Reference in new issue
Block a user