File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -44,8 +44,10 @@ import (
44
44
)
45
45
46
46
const (
47
- defaultGas = 90000
48
- defaultGasPrice = 50 * params .Shannon
47
+ defaultGas = 90000
48
+ defaultGasPrice = 50 * params .Shannon
49
+ receiptStatusSuccessful = 1
50
+ receiptStatusFailed = 0
49
51
)
50
52
51
53
// PublicEthereumAPI provides an API to access Ethereum related information.
@@ -991,7 +993,6 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(hash common.Hash) (map[
991
993
from , _ := types .Sender (signer , tx )
992
994
993
995
fields := map [string ]interface {}{
994
- "root" : hexutil .Bytes (receipt .PostState ),
995
996
"blockHash" : blockHash ,
996
997
"blockNumber" : hexutil .Uint64 (blockNumber ),
997
998
"transactionHash" : hash ,
@@ -1004,6 +1005,16 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(hash common.Hash) (map[
1004
1005
"logs" : receipt .Logs ,
1005
1006
"logsBloom" : receipt .Bloom ,
1006
1007
}
1008
+
1009
+ // Assign receipt status or post state.
1010
+ if len (receipt .PostState ) > 0 {
1011
+ fields ["root" ] = hexutil .Bytes (receipt .PostState )
1012
+ } else {
1013
+ fields ["status" ] = hexutil .Uint (receiptStatusSuccessful )
1014
+ if receipt .Failed {
1015
+ fields ["status" ] = hexutil .Uint (receiptStatusFailed )
1016
+ }
1017
+ }
1007
1018
if receipt .Logs == nil {
1008
1019
fields ["logs" ] = [][]* types.Log {}
1009
1020
}
You can’t perform that action at this time.
0 commit comments