Skip to content

Commit

Permalink
Map Ostracon:ErrTxInMap to lbm-sdk:ErrTxInMempoolCache
Browse files Browse the repository at this point in the history
  • Loading branch information
Mdaiki0730 committed Feb 9, 2023
1 parent e2aa3ea commit dd2dd86
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ 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
1 change: 1 addition & 0 deletions client/broadcast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func CreateContextWithErrorAndMode(err error, mode string) Context {
func TestBroadcastError(t *testing.T) {
errors := map[error]uint32{
mempool.ErrTxInCache: sdkerrors.ErrTxInMempoolCache.ABCICode(),
mempool.ErrTxInMap: sdkerrors.ErrTxInMempoolCache.ABCICode(),
mempool.ErrTxTooLarge{}: sdkerrors.ErrTxTooLarge.ABCICode(),
mempool.ErrMempoolIsFull{}: sdkerrors.ErrMempoolIsFull.ABCICode(),
}
Expand Down

0 comments on commit dd2dd86

Please sign in to comment.