Skip to content

Commit

Permalink
Revert "Simplify Effective Balance Calculation (#8743)"
Browse files Browse the repository at this point in the history
This reverts commit 45d2df1.
  • Loading branch information
nisdas committed Apr 30, 2021
1 parent f2767f4 commit e2bff02
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions beacon-chain/core/epoch/epoch_processing.go
Expand Up @@ -257,16 +257,12 @@ func ProcessEffectiveBalanceUpdates(state iface.BeaconState) (iface.BeaconState,
balance := bals[idx]

if balance+downwardThreshold < val.EffectiveBalance || val.EffectiveBalance+upwardThreshold < balance {
effectiveBal := maxEffBalance
if effectiveBal > balance-balance%effBalanceInc {
effectiveBal = balance - balance%effBalanceInc
newVal := stateV0.CopyValidator(val)
newVal.EffectiveBalance = maxEffBalance
if newVal.EffectiveBalance > balance-balance%effBalanceInc {
newVal.EffectiveBalance = balance - balance%effBalanceInc
}
if effectiveBal != val.EffectiveBalance {
newVal := stateV0.CopyValidator(val)
newVal.EffectiveBalance = effectiveBal
return true, newVal, nil
}
return false, val, nil
return true, newVal, nil
}
return false, val, nil
}
Expand Down

0 comments on commit e2bff02

Please sign in to comment.