Skip to content

Commit 069514e

Browse files
authored
client: update client error handling to use tx hash from tendermint (cosmos#9462)
1 parent ec3e2b4 commit 069514e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

client/broadcast.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"fmt"
66
"strings"
77

8-
"github.com/tendermint/tendermint/crypto/tmhash"
98
"github.com/tendermint/tendermint/mempool"
9+
tmtypes "github.com/tendermint/tendermint/types"
1010
"google.golang.org/grpc/codes"
1111
"google.golang.org/grpc/status"
1212

@@ -46,13 +46,13 @@ func (ctx Context) BroadcastTx(txBytes []byte) (res *sdk.TxResponse, err error)
4646
// TODO: Avoid brittle string matching in favor of error matching. This requires
4747
// a change to Tendermint's RPCError type to allow retrieval or matching against
4848
// a concrete error type.
49-
func CheckTendermintError(err error, txBytes []byte) *sdk.TxResponse {
49+
func CheckTendermintError(err error, tx tmtypes.Tx) *sdk.TxResponse {
5050
if err == nil {
5151
return nil
5252
}
5353

5454
errStr := strings.ToLower(err.Error())
55-
txHash := fmt.Sprintf("%X", tmhash.Sum(txBytes))
55+
txHash := fmt.Sprintf("%X", tx.Hash())
5656

5757
switch {
5858
case strings.Contains(errStr, strings.ToLower(mempool.ErrTxInCache.Error())):

0 commit comments

Comments
 (0)