Skip to content

Commit

Permalink
Fix Panic (#27)
Browse files Browse the repository at this point in the history
* fix comment in docs

* panics

* fix panic
  • Loading branch information
keefertaylor authored Dec 23, 2023
1 parent 3605ccc commit f132d6a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cosmos/tx/tx_broadcaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (b *Broadcaster) SignAndBroadcast(ctx context.Context, msgs []sdk.Msg) (txH
// Check if we failed
isSuccess, isSuccessErr := IsSuccess(broadcastResult)
if isSuccessErr != nil {
panic("should never happen")
panic("broadcaster::should never happen")
}

if !isSuccess {
Expand Down Expand Up @@ -382,14 +382,14 @@ func NewGasTrackingTxBroadcaster(
// NOTE: This function is just a pure pass through that does gas management
func (b *gasTrackingTxBroadcaster) signAndBroadcast(ctx context.Context, msgs []sdk.Msg) (broadcastResult *txtypes.BroadcastTxResponse, err error) {
result, originalBroadcastErr := b.wrappedBroadcaster.signAndBroadcast(ctx, msgs)
if err != nil {
if originalBroadcastErr != nil {
return nil, err
}

// Check for success
isSuccess, err := IsSuccess(result)
if err != nil {
panic("should never happen")
panic("gas_tracking_tx_broadcaster::should never happen")
}

// Don't adjust on successful broadcasts, instead wait to see if it successfully lands on chain.
Expand Down Expand Up @@ -485,7 +485,7 @@ func (b *retryableTxBroadcaster) signAndBroadcast(ctx context.Context, msgs []sd
time.Sleep(b.delay)

}
panic("should never happen")
panic("retryable_tx_broadcaster::sign_and_broadcast::should never happen")
}

func (b *retryableTxBroadcaster) checkTxStatus(ctx context.Context, txHash string) (*txtypes.GetTxResponse, error) {
Expand All @@ -512,7 +512,7 @@ func (b *retryableTxBroadcaster) checkTxStatus(ctx context.Context, txHash strin
b.logger.Error().Err(err).Uint("attempt", i+1).Uint("max_attempts", b.attempts).Msg("failed to check tx status, will retry.")
time.Sleep(b.delay)
}
panic("should never happen")
panic("retryable_tx_broadcaster::check_tx_status::should never happen")
}

// Helpers
Expand Down

0 comments on commit f132d6a

Please sign in to comment.