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

(cherry picked from commit 4d820ff4f5)

# Conflicts:
#	internal/p2p/peermanager.go
This commit is contained in:
Sam Kleinman
2022-06-17 22:27:46 +00:00
committed by Mergify
parent e2d01cdcff
commit ef9e9d158e
+5
View File
@@ -1300,12 +1300,17 @@ func (p *peerInfo) Score() PeerScore {
score -= int64(addr.DialFailures)
}
<<<<<<< HEAD
if score <= 0 {
return 0
}
if score >= math.MaxUint8 {
return PeerScore(math.MaxUint8)
=======
if score < math.MinInt16 {
score = math.MinInt16
>>>>>>> 4d820ff4f (p2p: peer score should not wrap around (#8790))
}
return PeerScore(score)