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

This commit is contained in:
Sam Kleinman
2022-06-17 18:27:38 -04:00
committed by GitHub
parent 82c1372f9e
commit 4d820ff4f5

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)
}