aboutsummaryrefslogtreecommitdiffstats
path: root/internal/ethapi/api.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2019-07-30 21:39:48 +0800
committerPéter Szilágyi <peterke@gmail.com>2019-07-30 21:39:48 +0800
commit96ab8e1575bb5e3a12a70dc6f349f4baa32f710a (patch)
tree01651a9f0b1fe2f2313f8869096a2010fbf7db5d /internal/ethapi/api.go
parentf34a3a68054eaad15d76c871eeabfa854df47dae (diff)
downloadgo-tangerine-96ab8e1575bb5e3a12a70dc6f349f4baa32f710a.tar
go-tangerine-96ab8e1575bb5e3a12a70dc6f349f4baa32f710a.tar.gz
go-tangerine-96ab8e1575bb5e3a12a70dc6f349f4baa32f710a.tar.bz2
go-tangerine-96ab8e1575bb5e3a12a70dc6f349f4baa32f710a.tar.lz
go-tangerine-96ab8e1575bb5e3a12a70dc6f349f4baa32f710a.tar.xz
go-tangerine-96ab8e1575bb5e3a12a70dc6f349f4baa32f710a.tar.zst
go-tangerine-96ab8e1575bb5e3a12a70dc6f349f4baa32f710a.zip
internal/ethapi: return null inclusion info for pending transactions (#19901)
This change ensures 'blockHash', 'blockNumber' and 'transactionIndex' are set to null for pending transactions. This behavior is required by the Ethereum JSON-RPC spec.
Diffstat (limited to 'internal/ethapi/api.go')
-rw-r--r--internal/ethapi/api.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go
index 1a5b5c343..a00598f82 100644
--- a/internal/ethapi/api.go
+++ b/internal/ethapi/api.go
@@ -1043,7 +1043,7 @@ func (s *PublicBlockChainAPI) rpcMarshalBlock(b *types.Block, inclTx bool, fullT
// RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction
type RPCTransaction struct {
- BlockHash common.Hash `json:"blockHash"`
+ BlockHash *common.Hash `json:"blockHash"`
BlockNumber *hexutil.Big `json:"blockNumber"`
From common.Address `json:"from"`
Gas hexutil.Uint64 `json:"gas"`
@@ -1052,7 +1052,7 @@ type RPCTransaction struct {
Input hexutil.Bytes `json:"input"`
Nonce hexutil.Uint64 `json:"nonce"`
To *common.Address `json:"to"`
- TransactionIndex hexutil.Uint `json:"transactionIndex"`
+ TransactionIndex *hexutil.Uint64 `json:"transactionIndex"`
Value *hexutil.Big `json:"value"`
V *hexutil.Big `json:"v"`
R *hexutil.Big `json:"r"`
@@ -1083,9 +1083,9 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber
S: (*hexutil.Big)(s),
}
if blockHash != (common.Hash{}) {
- result.BlockHash = blockHash
+ result.BlockHash = &blockHash
result.BlockNumber = (*hexutil.Big)(new(big.Int).SetUint64(blockNumber))
- result.TransactionIndex = hexutil.Uint(index)
+ result.TransactionIndex = (*hexutil.Uint64)(&index)
}
return result
}