MCPcopy
hub / github.com/canopy-network/canopy / ChangeReputation

Method ChangeReputation

p2p/set.go:148–169  ·  view source on GitHub ↗

ChangeReputation() updates the peer reputation +/- based on the int32 delta

(publicKey []byte, delta int32)

Source from the content-addressed store, hash-verified

146
147// ChangeReputation() updates the peer reputation +/- based on the int32 delta
148func (ps *PeerSet) ChangeReputation(publicKey []byte, delta int32) {
149 //unlock := lockWithTrace("peerset", &ps.mux, ps.logger)
150 //peer, err := ps.get(publicKey)
151 //if err != nil {
152 // unlock()
153 // return
154 //}
155 //
156 //peer.Reputation += delta
157 //if peer.Reputation >= MaxPeerReputation {
158 // peer.Reputation = MaxPeerReputation
159 //}
160 //
161 //shouldDisconnect := !peer.IsTrusted && !peer.IsMustConnect && peer.Reputation < MinimumPeerReputation
162 //conn := peer.conn
163 //ps.set(peer)
164 //unlock()
165 //
166 //if shouldDisconnect && conn != nil {
167 // conn.Error(fmt.Errorf("peer %s reputation too low", lib.BytesToTruncatedString(peer.Address.PublicKey)))
168 //}
169}
170
171// GetPeerInfo() returns a copy of the authenticated information from the peer structure
172func (ps *PeerSet) GetPeerInfo(publicKey []byte) (*lib.PeerInfo, lib.ErrorI) {

Callers 10

processQueueMethod · 0.80
verifyResponseMethod · 0.80
ListenForConsensusMethod · 0.80
pollMaxHeightMethod · 0.80
ListenForTxMethod · 0.80
ListenForBlockMethod · 0.80
ErrorMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected