Skip to content

Commit

Permalink
Map Ostracon:ErrTxInMap to lbm-sdk:ErrTxInMempoolCache (#890)
Browse files Browse the repository at this point in the history
* Map Ostracon:ErrTxInMap to lbm-sdk:ErrTxInMempoolCache

* Update CHANGELOG.md

* Refactor switch case
  • Loading branch information
Mdaiki0730 authored Feb 10, 2023
1 parent 4863dfa commit d70e63b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Improvements
* (cosmovisor) [\#792](https://github.com/line/lbm-sdk/pull/792) Use upstream's cosmovisor
* (server) [\#821](https://github.com/line/lbm-sdk/pull/821) Get validator pubkey considering KMS
* (client) [\#890](https://github.com/line/lbm-sdk/pull/890) Map Ostracon:ErrTxInMap to lbm-sdk:ErrTxInMempoolCache

### Bug Fixes
* (client) [\#817](https://github.com/line/lbm-sdk/pull/817) remove support for composite (BLS) type
Expand Down
3 changes: 2 additions & 1 deletion 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 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 d70e63b

Please sign in to comment.