Only apply validator set updates on initial genesis

This commit is contained in:
Christopher Goes 2018-11-13 15:38:29 +01:00
parent 10713e3c8a
commit 3686a3f47d
2 changed files with 2 additions and 14 deletions

View File

@ -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

View File

@ -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)