From 90475d5339603ee1671df5abe4f3f49369e83230 Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Mon, 15 Apr 2019 12:49:34 -0700 Subject: [PATCH] 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. --- discovery/gossiper.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/discovery/gossiper.go b/discovery/gossiper.go index cc290704..aad48eb8 100644 --- a/discovery/gossiper.go +++ b/discovery/gossiper.go @@ -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)