Clean up ProcessInactivityScores (#9483)

This commit is contained in:
terence tsao 2021-08-30 15:50:51 -07:00 committed by GitHub
parent 516401537a
commit 921acc300b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,12 +98,7 @@ func ProcessInactivityScores(
if v.IsPrevEpochTargetAttester && !v.IsSlashed { if v.IsPrevEpochTargetAttester && !v.IsSlashed {
// Decrease inactivity score when validator gets target correct. // Decrease inactivity score when validator gets target correct.
if v.InactivityScore > 0 { if v.InactivityScore > 0 {
score := uint64(1) v.InactivityScore -= 1
// Prevents underflow below 0.
if score > v.InactivityScore {
score = v.InactivityScore
}
v.InactivityScore -= score
} }
} else { } else {
v.InactivityScore += bias v.InactivityScore += bias