@@ -89,24 +89,26 @@ func CreateV021UpgradeHandler(mm *module.Manager, configurator module.Configurat
8989 }
9090
9191 /* ensure no delegations exist without starting info*/
92- allDels , err := k .StakingKeeper .GetAllDelegations (sdkCtx )
92+ allVals , err := k .StakingKeeper .GetAllValidators (sdkCtx )
9393 if err != nil {
9494 panic (err )
9595 }
96- for _ , del := range allDels {
96+ for _ , val := range allVals {
9797 /* ensure all rewards are patched */
98- val , err := k .StakingKeeper .Validator (sdkCtx , sdk .ValAddress (del . GetValidatorAddr () ))
98+ dels , err := k .StakingKeeper .GetValidatorDelegations (sdkCtx , sdk .ValAddress (val . OperatorAddress ))
9999 if err != nil {
100100 panic (err )
101101 }
102- endingPeriod , err := k .DistrKeeper .IncrementValidatorPeriod (sdkCtx , val )
103- if err != nil {
104- panic (err )
105- }
106- /* will error if still broken */
107- _ , err = k .DistrKeeper .CalculateDelegationRewards (sdkCtx , val , del , endingPeriod )
108- if err != nil {
109- panic (err )
102+ for _ , del := range dels {
103+ endingPeriod , err := k .DistrKeeper .IncrementValidatorPeriod (sdkCtx , val )
104+ if err != nil {
105+ panic (err )
106+ }
107+ /* will error if still broken */
108+ _ , err = k .DistrKeeper .CalculateDelegationRewards (sdkCtx , val , del , endingPeriod )
109+ if err != nil {
110+ panic (err )
111+ }
110112 }
111113 }
112114
0 commit comments