eth_getTransactionReceipt: return type & non-zero bloom if logs, rm root.

This commit is contained in:
Raúl Kripalani 2022-11-16 21:16:27 +00:00
parent a536f533d8
commit d441425618
2 changed files with 8 additions and 2 deletions

View File

@ -197,7 +197,6 @@ type EthTxReceipt struct {
BlockNumber EthUint64 `json:"blockNumber"` BlockNumber EthUint64 `json:"blockNumber"`
From EthAddress `json:"from"` From EthAddress `json:"from"`
To *EthAddress `json:"to"` To *EthAddress `json:"to"`
StateRoot EthHash `json:"root"`
Status EthUint64 `json:"status"` Status EthUint64 `json:"status"`
ContractAddress *EthAddress `json:"contractAddress"` ContractAddress *EthAddress `json:"contractAddress"`
CumulativeGasUsed EthUint64 `json:"cumulativeGasUsed"` CumulativeGasUsed EthUint64 `json:"cumulativeGasUsed"`
@ -205,6 +204,7 @@ type EthTxReceipt struct {
EffectiveGasPrice EthBigInt `json:"effectiveGasPrice"` EffectiveGasPrice EthBigInt `json:"effectiveGasPrice"`
LogsBloom EthBytes `json:"logsBloom"` LogsBloom EthBytes `json:"logsBloom"`
Logs []EthLog `json:"logs"` Logs []EthLog `json:"logs"`
Type EthUint64 `json:"type"`
} }
const ( const (

View File

@ -1459,7 +1459,7 @@ func newEthTxReceipt(ctx context.Context, tx api.EthTx, lookup *api.MsgLookup, r
BlockNumber: tx.BlockNumber, BlockNumber: tx.BlockNumber,
From: tx.From, From: tx.From,
To: tx.To, To: tx.To,
StateRoot: api.EmptyEthHash, Type: api.EthUint64(2),
LogsBloom: []byte{0}, LogsBloom: []byte{0},
} }
@ -1481,6 +1481,12 @@ func newEthTxReceipt(ctx context.Context, tx api.EthTx, lookup *api.MsgLookup, r
} }
if len(events) > 0 { if len(events) > 0 {
// TODO return a dummy non-zero bloom to signal that there are logs
// need to figure out how worth it is to populate with a real bloom
// should be feasible here since we are iterating over the logs anyway
receipt.LogsBloom = make([]byte, 256)
receipt.LogsBloom[255] = 0x01
receipt.Logs = make([]api.EthLog, 0, len(events)) receipt.Logs = make([]api.EthLog, 0, len(events))
for i, evt := range events { for i, evt := range events {
l := api.EthLog{ l := api.EthLog{