discovery: check nil policy within isMsgStale

If both policies don't exist, then this would result in a panic. Since
they don't exist, we can assume the policy we're currently evaluating is
fresh.
This commit is contained in:
Wilmer Paulino 2019-04-15 12:49:34 -07:00
parent c1f7732a31
commit 90475d5339
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

View File

@ -2361,6 +2361,12 @@ func (d *AuthenticatedGossiper) isMsgStale(msg lnwire.Message) bool {
p = p2
}
// If the policy is still unknown, then we can consider this
// policy fresh.
if p == nil {
return false
}
timestamp := time.Unix(int64(msg.Timestamp), 0)
return p.LastUpdate.After(timestamp)