Skip to content

Commit

Permalink
update simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
yun-yeo committed Mar 18, 2021
1 parent 1bda73e commit 7042dd4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions x/oracle/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ func SimulateMsgExchangeRatePrevote(ak authkeeper.AccountKeeper, k keeper.Keeper

// ensure the validator exists
val := k.StakingKeeper.Validator(ctx, address)
if val == nil {
power := k.StakingKeeper.GetLastValidatorPower(ctx, address)
if val == nil || !val.IsBonded() || power == 0 {
return simulation.NoOpMsg(types.ModuleName), nil, nil
}

Expand Down Expand Up @@ -141,7 +142,8 @@ func SimulateMsgExchangeRateVote(ak authkeeper.AccountKeeper, k keeper.Keeper) s

// ensure the validator exists
val := k.StakingKeeper.Validator(ctx, address)
if val == nil {
power := k.StakingKeeper.GetLastValidatorPower(ctx, address)
if val == nil || !val.IsBonded() || power == 0 {
return simulation.NoOpMsg(types.ModuleName), nil, nil
}

Expand Down Expand Up @@ -208,7 +210,8 @@ func SimulateMsgDelegateFeedConsent(ak authkeeper.AccountKeeper, k keeper.Keeper

// ensure the validator exists
val := k.StakingKeeper.Validator(ctx, valAddress)
if val == nil {
power := k.StakingKeeper.GetLastValidatorPower(ctx, address)
if val == nil || !val.IsBonded() || power == 0 {
return simulation.NoOpMsg(types.ModuleName), nil, nil
}

Expand Down

0 comments on commit 7042dd4

Please sign in to comment.