Export for zero height fixes (#3183)
This commit is contained in:
committed by
Jack Zampolin
parent
131ad378e0
commit
feff014df1
+17
-2
@@ -92,6 +92,7 @@ func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context) {
|
||||
})
|
||||
app.distrKeeper.IterateValidatorDistInfos(ctx, func(_ int64, valInfo distr.ValidatorDistInfo) (stop bool) {
|
||||
valInfo.FeePoolWithdrawalHeight = 0
|
||||
valInfo.DelAccum.UpdateHeight = 0
|
||||
app.distrKeeper.SetValidatorDistInfo(ctx, valInfo)
|
||||
return false
|
||||
})
|
||||
@@ -113,12 +114,26 @@ func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context) {
|
||||
|
||||
/* Handle stake state. */
|
||||
|
||||
// iterate through redelegations, reset creation height
|
||||
app.stakeKeeper.IterateRedelegations(ctx, func(_ int64, red stake.Redelegation) (stop bool) {
|
||||
red.CreationHeight = 0
|
||||
app.stakeKeeper.SetRedelegation(ctx, red)
|
||||
return false
|
||||
})
|
||||
|
||||
// iterate through unbonding delegations, reset creation height
|
||||
app.stakeKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stake.UnbondingDelegation) (stop bool) {
|
||||
ubd.CreationHeight = 0
|
||||
app.stakeKeeper.SetUnbondingDelegation(ctx, ubd)
|
||||
return false
|
||||
})
|
||||
|
||||
// iterate through validators by power descending, reset bond height, update bond intra-tx counter
|
||||
store := ctx.KVStore(app.keyStake)
|
||||
iter := sdk.KVStoreReversePrefixIterator(store, stake.ValidatorsByPowerIndexKey)
|
||||
iter := sdk.KVStoreReversePrefixIterator(store, stake.ValidatorsKey)
|
||||
counter := int16(0)
|
||||
for ; iter.Valid(); iter.Next() {
|
||||
addr := sdk.ValAddress(iter.Value())
|
||||
addr := sdk.ValAddress(iter.Key()[1:])
|
||||
validator, found := app.stakeKeeper.GetValidator(ctx, addr)
|
||||
if !found {
|
||||
panic("expected validator, not found")
|
||||
|
||||
Reference in New Issue
Block a user