aboutsummaryrefslogtreecommitdiffstats
path: root/internal
diff options
context:
space:
mode:
authorrjl493456442 <garyrong0905@gmail.com>2017-08-26 15:30:56 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-10-02 16:42:53 +0800
commita31835c8b4086582879a4e7a48e4bdb5e4dccc3d (patch)
tree80e3d128a8a9eba610991d426380589061b7a6b1 /internal
parentd78ad226c26c84635c60fad233de9e6e438a5599 (diff)
downloadgo-tangerine-a31835c8b4086582879a4e7a48e4bdb5e4dccc3d.tar
go-tangerine-a31835c8b4086582879a4e7a48e4bdb5e4dccc3d.tar.gz
go-tangerine-a31835c8b4086582879a4e7a48e4bdb5e4dccc3d.tar.bz2
go-tangerine-a31835c8b4086582879a4e7a48e4bdb5e4dccc3d.tar.lz
go-tangerine-a31835c8b4086582879a4e7a48e4bdb5e4dccc3d.tar.xz
go-tangerine-a31835c8b4086582879a4e7a48e4bdb5e4dccc3d.tar.zst
go-tangerine-a31835c8b4086582879a4e7a48e4bdb5e4dccc3d.zip
internal/ethapi: add status code to receipt rpc return
Diffstat (limited to 'internal')
-rw-r--r--internal/ethapi/api.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go
index 8d1a6f746..a7cb08466 100644
--- a/internal/ethapi/api.go
+++ b/internal/ethapi/api.go
@@ -44,8 +44,10 @@ import (
)
const (
- defaultGas = 90000
- defaultGasPrice = 50 * params.Shannon
+ defaultGas = 90000
+ defaultGasPrice = 50 * params.Shannon
+ receiptStatusSuccessful = 1
+ receiptStatusFailed = 0
)
// PublicEthereumAPI provides an API to access Ethereum related information.
@@ -991,7 +993,6 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(hash common.Hash) (map[
from, _ := types.Sender(signer, tx)
fields := map[string]interface{}{
- "root": hexutil.Bytes(receipt.PostState),
"blockHash": blockHash,
"blockNumber": hexutil.Uint64(blockNumber),
"transactionHash": hash,
@@ -1004,6 +1005,16 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(hash common.Hash) (map[
"logs": receipt.Logs,
"logsBloom": receipt.Bloom,
}
+
+ // Assign receipt status or post state.
+ if len(receipt.PostState) > 0 {
+ fields["root"] = hexutil.Bytes(receipt.PostState)
+ } else {
+ fields["status"] = hexutil.Uint(receiptStatusSuccessful)
+ if receipt.Failed {
+ fields["status"] = hexutil.Uint(receiptStatusFailed)
+ }
+ }
if receipt.Logs == nil {
fields["logs"] = [][]*types.Log{}
}