diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 1b7078a42901..014ed4b3aa1e 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -2233,38 +2233,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, ha // Derive the sender. bigblock := new(big.Int).SetUint64(blockNumber) signer := types.MakeSigner(s.b.ChainConfig(), bigblock) - from, _ := types.Sender(signer, tx) - - fields := map[string]interface{}{ - "blockHash": blockHash, - "blockNumber": hexutil.Uint64(blockNumber), - "transactionHash": hash, - "transactionIndex": hexutil.Uint64(index), - "from": from, - "to": tx.To(), - "gasUsed": hexutil.Uint64(receipt.GasUsed), - "cumulativeGasUsed": hexutil.Uint64(receipt.CumulativeGasUsed), - "contractAddress": nil, - "logs": receipt.Logs, - "logsBloom": receipt.Bloom, - "type": hexutil.Uint(tx.Type()), - "effectiveGasPrice": (*hexutil.Big)(receipt.EffectiveGasPrice), - } - - // Assign receipt status or post state. - if len(receipt.PostState) > 0 { - fields["root"] = hexutil.Bytes(receipt.PostState) - } else { - fields["status"] = hexutil.Uint(receipt.Status) - } - if receipt.Logs == nil { - fields["logs"] = [][]*types.Log{} - } - // If the ContractAddress is 20 0x0 bytes, assume it is not a contract creation - if receipt.ContractAddress != (common.Address{}) { - fields["contractAddress"] = receipt.ContractAddress - } - return fields, nil + return marshalReceipt(receipt, blockHash, blockNumber, signer, tx, int(index)), nil } // marshalReceipt marshals a transaction receipt into a JSON object. @@ -2284,8 +2253,7 @@ func marshalReceipt(receipt *types.Receipt, blockHash common.Hash, blockNumber u "logs": receipt.Logs, "logsBloom": receipt.Bloom, "type": hexutil.Uint(tx.Type()), - // uncomment below line after EIP-1559 - // TODO: "effectiveGasPrice": (*hexutil.Big)(receipt.EffectiveGasPrice), + "effectiveGasPrice": (*hexutil.Big)(receipt.EffectiveGasPrice), } // Assign receipt status or post state.