Merge PR #5421: Refactor Error Handling
This commit is contained in:
@@ -93,7 +93,7 @@ func SimulateMsgUnjail(ak types.AccountKeeper, k keeper.Keeper, sk stakingkeeper
|
||||
simAccount.PrivKey,
|
||||
)
|
||||
|
||||
res := app.Deliver(tx)
|
||||
_, res, err := app.Deliver(tx)
|
||||
|
||||
// result should fail if:
|
||||
// - validator cannot be unjailed due to tombstone
|
||||
@@ -102,7 +102,7 @@ func SimulateMsgUnjail(ak types.AccountKeeper, k keeper.Keeper, sk stakingkeeper
|
||||
if info.Tombstoned ||
|
||||
ctx.BlockHeader().Time.Before(info.JailedUntil) ||
|
||||
validator.TokensFromShares(selfDel.GetShares()).TruncateInt().LT(validator.GetMinSelfDelegation()) {
|
||||
if res.IsOK() {
|
||||
if res != nil && err == nil {
|
||||
if info.Tombstoned {
|
||||
return simulation.NewOperationMsg(msg, true, ""), nil, errors.New("validator should not have been unjailed if validator tombstoned")
|
||||
}
|
||||
@@ -117,7 +117,7 @@ func SimulateMsgUnjail(ak types.AccountKeeper, k keeper.Keeper, sk stakingkeeper
|
||||
return simulation.NewOperationMsg(msg, false, ""), nil, nil
|
||||
}
|
||||
|
||||
if !res.IsOK() {
|
||||
if err != nil {
|
||||
return simulation.NoOpMsg(types.ModuleName), nil, errors.New(res.Log)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user