SetFromParamStruct -> SetStruct

This commit is contained in:
mossid 2018-09-19 01:27:54 +09:00
parent 991ac424d2
commit d6105c5855
3 changed files with 10 additions and 9 deletions

View File

@ -112,8 +112,15 @@ func (s Store) SetRaw(ctx sdk.Context, key string, param []byte) {
tstore.Set(keybz, []byte{})
}
// Get to ParamStruct
func (s Store) GetStruct(ctx sdk.Context, ps ParamStruct) {
for _, pair := range ps.KeyFieldPairs() {
s.Get(ctx, pair.Key, pair.Field)
}
}
// Set from ParamStruct
func (s Store) SetFromParamStruct(ctx sdk.Context, ps ParamStruct) {
func (s Store) SetStruct(ctx sdk.Context, ps ParamStruct) {
for _, pair := range ps.KeyFieldPairs() {
s.Set(ctx, pair.Key, pair.Field)
}

View File

@ -24,5 +24,5 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState, sdata types.
keeper.addPubkey(ctx, validator.GetPubKey())
}
keeper.paramstore.SetFromParamStruct(ctx, &data.Params)
keeper.paramstore.SetStruct(ctx, &data.Params)
}

View File

@ -79,11 +79,5 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
// set the params without updating validator set
func (k Keeper) SetNewParams(ctx sdk.Context, params types.Params) {
k.paramstore.Set(ctx, types.KeyInflationRateChange, params.InflationRateChange)
k.paramstore.Set(ctx, types.KeyInflationMax, params.InflationMax)
k.paramstore.Set(ctx, types.KeyInflationMin, params.InflationMin)
k.paramstore.Set(ctx, types.KeyGoalBonded, params.GoalBonded)
k.paramstore.Set(ctx, types.KeyUnbondingTime, params.UnbondingTime)
k.paramstore.Set(ctx, types.KeyMaxValidators, params.MaxValidators)
k.paramstore.Set(ctx, types.KeyBondDenom, params.BondDenom)
k.paramstore.SetStruct(ctx, &params)
}