From 9a57b66ae8e87a4d90723f509c80c4704c6da42f Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Tue, 7 Mar 2023 21:15:27 -0600 Subject: [PATCH] peer: Correct known inventory check. This updates AddKnownInventory and IsKnownInventory to use the concrete struct as opposed to a pointer to it in order to allow different instances of the struct to be used as a key versus needing to check with the same instance. --- peer/peer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/peer/peer.go b/peer/peer.go index c68f95b813..57d793d933 100644 --- a/peer/peer.go +++ b/peer/peer.go @@ -500,7 +500,7 @@ func (p *Peer) UpdateLastBlockHeight(newHeight int64) { // // This function is safe for concurrent access. func (p *Peer) AddKnownInventory(invVect *wire.InvVect) { - p.knownInventory.Add(invVect) + p.knownInventory.Add(*invVect) } // IsKnownInventory returns whether the passed inventory already exists in @@ -508,7 +508,7 @@ func (p *Peer) AddKnownInventory(invVect *wire.InvVect) { // // This function is safe for concurrent access. func (p *Peer) IsKnownInventory(invVect *wire.InvVect) bool { - return p.knownInventory.Contains(invVect) + return p.knownInventory.Contains(*invVect) } // StatsSnapshot returns a snapshot of the current peer flags and statistics.