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
This commit is contained in:
KamiD 2021-01-18 21:28:52 +08:00 committed by GitHub
parent 35bb751bac
commit cfe629c14f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -472,6 +472,9 @@ func (api *PublicEthereumAPI) SendTransaction(args rpctypes.SendTxArgs) (common.
return common.Hash{}, err return common.Hash{}, err
} }
if res.Code != abci.CodeTypeOK {
return common.Hash{}, fmt.Errorf(res.RawLog)
}
// Return transaction hash // Return transaction hash
return common.HexToHash(res.TxHash), nil return common.HexToHash(res.TxHash), nil
} }
@ -501,6 +504,9 @@ func (api *PublicEthereumAPI) SendRawTransaction(data hexutil.Bytes) (common.Has
return common.Hash{}, err return common.Hash{}, err
} }
if res.Code != abci.CodeTypeOK {
return common.Hash{}, fmt.Errorf(res.RawLog)
}
// Return transaction hash // Return transaction hash
return common.HexToHash(res.TxHash), nil return common.HexToHash(res.TxHash), nil
} }