Skip to content

Commit

Permalink
Refactor switch case
Browse files Browse the repository at this point in the history
  • Loading branch information
Mdaiki0730 committed Feb 10, 2023
1 parent 915081c commit 1a653b1
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions client/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ func CheckTendermintError(err error, tx octypes.Tx) *sdk.TxResponse {
txHash := fmt.Sprintf("%X", tx.Hash())

switch {
case strings.Contains(errStr, strings.ToLower(mempool.ErrTxInCache.Error())):
case strings.Contains(errStr, strings.ToLower(mempool.ErrTxInCache.Error())),
strings.Contains(errStr, strings.ToLower(mempool.ErrTxInMap.Error())):
return &sdk.TxResponse{
Code: sdkerrors.ErrTxInMempoolCache.ABCICode(),
Codespace: sdkerrors.ErrTxInMempoolCache.Codespace(),
Expand All @@ -77,13 +78,6 @@ func CheckTendermintError(err error, tx octypes.Tx) *sdk.TxResponse {
TxHash: txHash,
}

case strings.Contains(errStr, strings.ToLower(mempool.ErrTxInMap.Error())):
return &sdk.TxResponse{
Code: sdkerrors.ErrTxInMempoolCache.ABCICode(),
Codespace: sdkerrors.ErrTxInMempoolCache.Codespace(),
TxHash: txHash,
}

default:
return nil
}
Expand Down

0 comments on commit 1a653b1

Please sign in to comment.