Merge PR #5421: Refactor Error Handling

This commit is contained in:
Alexander Bezobchuk
2019-12-27 12:57:54 -05:00
committed by GitHub
parent 3c82b66347
commit 9a183ffbcc
170 changed files with 2317 additions and 2934 deletions
+3 -3
View File
@@ -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)
}