From cfe629c14ffddb4a9fc1a8ded13ae1d4c720d6d7 Mon Sep 17 00:00:00 2001 From: KamiD <44460798+KamiD@users.noreply.github.com> Date: Mon, 18 Jan 2021 21:28:52 +0800 Subject: [PATCH] rpc: fix metamask pending while sending an error transaction (#711) * fix pending state in metamaks wallet when sending an error tx and rejected by antehandle * using abci.CodeTypeOK instead 0 --- rpc/namespaces/eth/api.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rpc/namespaces/eth/api.go b/rpc/namespaces/eth/api.go index 69baf413..ee3dd6f2 100644 --- a/rpc/namespaces/eth/api.go +++ b/rpc/namespaces/eth/api.go @@ -472,6 +472,9 @@ func (api *PublicEthereumAPI) SendTransaction(args rpctypes.SendTxArgs) (common. return common.Hash{}, err } + if res.Code != abci.CodeTypeOK { + return common.Hash{}, fmt.Errorf(res.RawLog) + } // Return transaction hash return common.HexToHash(res.TxHash), nil } @@ -501,6 +504,9 @@ func (api *PublicEthereumAPI) SendRawTransaction(data hexutil.Bytes) (common.Has return common.Hash{}, err } + if res.Code != abci.CodeTypeOK { + return common.Hash{}, fmt.Errorf(res.RawLog) + } // Return transaction hash return common.HexToHash(res.TxHash), nil }