Skip to content

Commit

Permalink
peer: Correct known inventory check.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
davecgh committed Mar 8, 2023
1 parent 2534bb7 commit 9a57b66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions peer/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,15 +500,15 @@ 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
// the known inventory for the peer.
//
// 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.
Expand Down

0 comments on commit 9a57b66

Please sign in to comment.