p2p: peer score should not wrap around (#8790) (#8792)

(cherry picked from commit 4d820ff4f5)

Co-authored-by: Sam Kleinman <garen@tychoish.com>
This commit is contained in:
mergify[bot]
2022-06-17 20:41:55 -04:00
committed by GitHub
co-authored by Sam Kleinman
parent 7728ae6e04
commit 74f3e15dc9
+4
View File
@@ -1538,6 +1538,10 @@ func (p *peerInfo) Score() PeerScore {
score -= int64(addr.DialFailures)
}
if score < math.MinInt16 {
score = math.MinInt16
}
return PeerScore(score)
}