Only apply validator set updates on initial genesis
This commit is contained in:
parent
10713e3c8a
commit
3686a3f47d
@ -68,15 +68,13 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState) (res [
|
||||
keeper.InsertRedelegationQueue(ctx, red)
|
||||
}
|
||||
|
||||
res = keeper.ApplyAndReturnValidatorSetUpdates(ctx)
|
||||
|
||||
// overwrite the pool since we exported
|
||||
if data.Exported {
|
||||
keeper.SetPool(ctx, data.Pool)
|
||||
keeper.ClearLastValidatorPowers(ctx)
|
||||
for _, lv := range data.LastValidatorPowers {
|
||||
keeper.SetLastValidatorPower(ctx, lv.Address, lv.Power)
|
||||
}
|
||||
} else {
|
||||
res = keeper.ApplyAndReturnValidatorSetUpdates(ctx)
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
@ -127,16 +127,6 @@ func (k Keeper) IterateLastValidatorPowers(ctx sdk.Context, handler func(operato
|
||||
}
|
||||
}
|
||||
|
||||
// Clear last validator powers.
|
||||
func (k Keeper) ClearLastValidatorPowers(ctx sdk.Context) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
iter := sdk.KVStorePrefixIterator(store, LastValidatorPowerKey)
|
||||
defer iter.Close()
|
||||
for ; iter.Valid(); iter.Next() {
|
||||
store.Delete(iter.Key())
|
||||
}
|
||||
}
|
||||
|
||||
// Delete the last validator power.
|
||||
func (k Keeper) DeleteLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user