ChangeReputation() updates the peer reputation +/- based on the int32 delta
(publicKey []byte, delta int32)
| 146 | |
| 147 | // ChangeReputation() updates the peer reputation +/- based on the int32 delta |
| 148 | func (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 |
| 172 | func (ps *PeerSet) GetPeerInfo(publicKey []byte) (*lib.PeerInfo, lib.ErrorI) { |
no outgoing calls
no test coverage detected