Skip to content

Commit

Permalink
Restores panics to #485 (#491)
Browse files Browse the repository at this point in the history
* back to panic

* comments

Co-authored-by: Marius Poke <marius.poke@posteo.de>
Co-authored-by: Shawn Marshall-Spitzbart <44221603+smarshall-spitzbart@users.noreply.github.com>
  • Loading branch information
3 people committed Nov 18, 2022
1 parent f47bef7 commit a1f5ae1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions x/ccv/provider/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ func (h Hooks) AfterUnbondingInitiated(ctx sdk.Context, ID uint64) error {

// Set unbondingOp
if err := h.k.SetUnbondingOp(ctx, unbondingOp); err != nil {
return fmt.Errorf("unbonding op could not be persisted: %w", err)
// If there was an error persisting the unbonding op, panic to end execution for
// the current tx and prevent committal of this invalid state.
panic(fmt.Errorf("unbonding op could not be persisted: %w", err))
}

// Call back into staking to tell it to stop this op from unbonding when the unbonding period is complete
if err := h.k.stakingKeeper.PutUnbondingOnHold(ctx, ID); err != nil {
return fmt.Errorf("unbonding could not be put on hold: %w", err)
// If there was an error putting the unbonding on hold, panic to end execution for
// the current tx and prevent committal of this invalid state.
panic(fmt.Errorf("unbonding could not be put on hold: %w", err))
}
return nil
}
Expand Down

0 comments on commit a1f5ae1

Please sign in to comment.