From c959ecc4c98ad47809995976926a8e642ea937f7 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 9 Apr 2021 14:38:32 -0700 Subject: [PATCH] discovery: always add chan announcements to the reject cache if err != ErrIgnored In this commit, we make a change to always add chan announcements to the reject cache if we didn't reject them for already existing. Without this change, if we end up rejecting a channel announcement say because the channel is already spent or the funding transaction doesn't exist, then we'll end up continually re-validating the same set of channels we know will fail, when they're sent to us by peers. Fixes #5191 --- discovery/gossiper.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/discovery/gossiper.go b/discovery/gossiper.go index 2c4c07b0..8bb3b96c 100644 --- a/discovery/gossiper.go +++ b/discovery/gossiper.go @@ -1741,6 +1741,10 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement( } else { log.Tracef("Router rejected channel "+ "edge: %v", err) + + d.rejectMtx.Lock() + d.recentRejects[msg.ShortChannelID.ToUint64()] = struct{}{} + d.rejectMtx.Unlock() } nMsg.err <- err