From ef9e9d158e40f2e6fd3a24a15785b683a5199403 Mon Sep 17 00:00:00 2001 From: Sam Kleinman Date: Fri, 17 Jun 2022 18:27:38 -0400 Subject: [PATCH] p2p: peer score should not wrap around (#8790) (cherry picked from commit 4d820ff4f5c93cf00e7618b2d3086ad23e1bb5de) # Conflicts: # internal/p2p/peermanager.go --- internal/p2p/peermanager.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/p2p/peermanager.go b/internal/p2p/peermanager.go index b2f4c8f41..7e330e049 100644 --- a/internal/p2p/peermanager.go +++ b/internal/p2p/peermanager.go @@ -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)