From 4a32cf2691f521666b3a69aa07b955ed769ccf1b Mon Sep 17 00:00:00 2001 From: KamiD Date: Wed, 13 Jan 2021 16:59:10 +0800 Subject: [PATCH 1/2] fix pending state in metamaks wallet when sending an error tx and rejected by antehandle --- 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 69baf413c..fea504bc3 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 != 0 { + 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 != 0 { + return common.Hash{}, fmt.Errorf(res.RawLog) + } // Return transaction hash return common.HexToHash(res.TxHash), nil } From 5cd8bbd3066b5eec9b242c84c68bb03f2626baa0 Mon Sep 17 00:00:00 2001 From: KamiD Date: Wed, 13 Jan 2021 17:15:02 +0800 Subject: [PATCH 2/2] using abci.CodeTypeOK instead 0 --- rpc/namespaces/eth/api.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpc/namespaces/eth/api.go b/rpc/namespaces/eth/api.go index fea504bc3..ee3dd6f21 100644 --- a/rpc/namespaces/eth/api.go +++ b/rpc/namespaces/eth/api.go @@ -472,7 +472,7 @@ func (api *PublicEthereumAPI) SendTransaction(args rpctypes.SendTxArgs) (common. return common.Hash{}, err } - if res.Code != 0 { + if res.Code != abci.CodeTypeOK { return common.Hash{}, fmt.Errorf(res.RawLog) } // Return transaction hash @@ -504,7 +504,7 @@ func (api *PublicEthereumAPI) SendRawTransaction(data hexutil.Bytes) (common.Has return common.Hash{}, err } - if res.Code != 0 { + if res.Code != abci.CodeTypeOK { return common.Hash{}, fmt.Errorf(res.RawLog) } // Return transaction hash