Skip to content

Commit

Permalink
Optimize: do not run NCalcEMA if already at same value
Browse files Browse the repository at this point in the history
  • Loading branch information
xmariachi committed Jan 20, 2025
1 parent 41ee793 commit 879a2f5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions x/emissions/keeper/actor_penalties.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ func ApplyLivenessPenaltyToActor(
return types.Score{}, err
}

if emaScore.Score.Equal(penalty) {
return emaScore, nil
}

beforePenalty := emaScore
emaScore.Score, err = applyPenalty(topic, penalty, emaScore.Score, missedEpochs)
if err != nil {
Expand Down

0 comments on commit 879a2f5

Please sign in to comment.