Skip to content

Commit

Permalink
fix process id error
Browse files Browse the repository at this point in the history
  • Loading branch information
aquarius-kuchain committed Oct 28, 2020
1 parent b32e73b commit e020ab2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion utils/version/validator_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func toNormalAccountID(acc chainTypes.AccountID) chainTypes.AccountID {
return chainTypes.AccountID{val}
}

func ProcessValidatorID(ctx sdk.Context, val types.Validator) {
func ProcessValidatorID(ctx sdk.Context, val *types.Validator) {
blockNum := ctx.BlockHeight()

if blockNum > 657926 {
Expand All @@ -65,6 +65,7 @@ func ProcessValidatorID(ctx sdk.Context, val types.Validator) {
}

if _, ok := toLargeNumMap[blockNum]; ok {
ctx.Logger().Info("use large num accountid", "block", blockNum)
val.OperatorAccount.Value = val.OperatorAccount.StoreKey()
} else {
val.OperatorAccount = toNormalAccountID(val.OperatorAccount)
Expand Down
4 changes: 2 additions & 2 deletions x/staking/keeper/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (k Keeper) GetValidator(ctx sdk.Context, acc types.AccountID) (validator ty
valToReturn := val.val
// Doesn't mutate the cache's value
valToReturn.OperatorAccount = acc
version.ProcessValidatorID(ctx, valToReturn)
version.ProcessValidatorID(ctx, &valToReturn)
return valToReturn, true
}

Expand All @@ -60,7 +60,7 @@ func (k Keeper) GetValidator(ctx sdk.Context, acc types.AccountID) (validator ty
}

validator = types.MustUnmarshalValidator(k.cdc, value)
version.ProcessValidatorID(ctx, validator)
version.ProcessValidatorID(ctx, &validator)
return validator, true
}

Expand Down

0 comments on commit e020ab2

Please sign in to comment.