@@ -1333,18 +1333,15 @@ func RPCMarshalHeader(head *types.Header) map[string]interface{} {
13331333 "transactionsRoot" : head .TxHash ,
13341334 "receiptsRoot" : head .ReceiptHash ,
13351335 }
1336+
13361337 if head .BaseFee != nil {
13371338 result ["baseFeePerGas" ] = (* hexutil .Big )(head .BaseFee )
13381339 }
1340+
13391341 if head .WithdrawalsHash != nil {
13401342 result ["withdrawalsRoot" ] = head .WithdrawalsHash
13411343 }
1342- if head .BlobGasUsed != nil {
1343- result ["blobGasUsed" ] = hexutil .Uint64 (* head .BlobGasUsed )
1344- }
1345- if head .ExcessBlobGas != nil {
1346- result ["excessBlobGas" ] = hexutil .Uint64 (* head .ExcessBlobGas )
1347- }
1344+
13481345 return result
13491346}
13501347
@@ -1403,28 +1400,26 @@ func (s *BlockChainAPI) rpcMarshalBlock(ctx context.Context, b *types.Block, inc
14031400
14041401// RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction
14051402type RPCTransaction struct {
1406- BlockHash * common.Hash `json:"blockHash"`
1407- BlockNumber * hexutil.Big `json:"blockNumber"`
1408- From common.Address `json:"from"`
1409- Gas hexutil.Uint64 `json:"gas"`
1410- GasPrice * hexutil.Big `json:"gasPrice"`
1411- GasFeeCap * hexutil.Big `json:"maxFeePerGas,omitempty"`
1412- GasTipCap * hexutil.Big `json:"maxPriorityFeePerGas,omitempty"`
1413- MaxFeePerBlobGas * hexutil.Big `json:"maxFeePerBlobGas,omitempty"`
1414- Hash common.Hash `json:"hash"`
1415- Input hexutil.Bytes `json:"input"`
1416- Nonce hexutil.Uint64 `json:"nonce"`
1417- To * common.Address `json:"to"`
1418- TransactionIndex * hexutil.Uint64 `json:"transactionIndex"`
1419- Value * hexutil.Big `json:"value"`
1420- Type hexutil.Uint64 `json:"type"`
1421- Accesses * types.AccessList `json:"accessList,omitempty"`
1422- ChainID * hexutil.Big `json:"chainId,omitempty"`
1423- BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"`
1424- V * hexutil.Big `json:"v"`
1425- R * hexutil.Big `json:"r"`
1426- S * hexutil.Big `json:"s"`
1427- YParity * hexutil.Uint64 `json:"yParity,omitempty"`
1403+ BlockHash * common.Hash `json:"blockHash"`
1404+ BlockNumber * hexutil.Big `json:"blockNumber"`
1405+ From common.Address `json:"from"`
1406+ Gas hexutil.Uint64 `json:"gas"`
1407+ GasPrice * hexutil.Big `json:"gasPrice"`
1408+ GasFeeCap * hexutil.Big `json:"maxFeePerGas,omitempty"`
1409+ GasTipCap * hexutil.Big `json:"maxPriorityFeePerGas,omitempty"`
1410+ Hash common.Hash `json:"hash"`
1411+ Input hexutil.Bytes `json:"input"`
1412+ Nonce hexutil.Uint64 `json:"nonce"`
1413+ To * common.Address `json:"to"`
1414+ TransactionIndex * hexutil.Uint64 `json:"transactionIndex"`
1415+ Value * hexutil.Big `json:"value"`
1416+ Type hexutil.Uint64 `json:"type"`
1417+ Accesses * types.AccessList `json:"accessList,omitempty"`
1418+ ChainID * hexutil.Big `json:"chainId,omitempty"`
1419+ V * hexutil.Big `json:"v"`
1420+ R * hexutil.Big `json:"r"`
1421+ S * hexutil.Big `json:"s"`
1422+ YParity * hexutil.Uint64 `json:"yParity,omitempty"`
14281423}
14291424
14301425// newRPCTransaction returns a transaction that will serialize to the RPC
@@ -1478,43 +1473,15 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber
14781473 // if the transaction has been mined, compute the effective gas price
14791474 if baseFee != nil && blockHash != (common.Hash {}) {
14801475 // price = min(gasTipCap + baseFee, gasFeeCap)
1481- result .GasPrice = (* hexutil .Big )(effectiveGasPrice (tx , baseFee ))
1482- } else {
1483- result .GasPrice = (* hexutil .Big )(tx .GasFeeCap ())
1484- }
1485-
1486- case types .BlobTxType :
1487- al := tx .AccessList ()
1488- yparity := hexutil .Uint64 (v .Sign ())
1489- result .Accesses = & al
1490- result .ChainID = (* hexutil .Big )(tx .ChainId ())
1491- result .YParity = & yparity
1492- result .GasFeeCap = (* hexutil .Big )(tx .GasFeeCap ())
1493- result .GasTipCap = (* hexutil .Big )(tx .GasTipCap ())
1494- // if the transaction has been mined, compute the effective gas price
1495- if baseFee != nil && blockHash != (common.Hash {}) {
1496- result .GasPrice = (* hexutil .Big )(effectiveGasPrice (tx , baseFee ))
1476+ price := math .BigMin (new (big.Int ).Add (tx .GasTipCap (), baseFee ), tx .GasFeeCap ())
1477+ result .GasPrice = (* hexutil .Big )(price )
14971478 } else {
14981479 result .GasPrice = (* hexutil .Big )(tx .GasFeeCap ())
14991480 }
1500- result .MaxFeePerBlobGas = (* hexutil .Big )(tx .BlobGasFeeCap ())
1501- result .BlobVersionedHashes = tx .BlobHashes ()
15021481 }
15031482 return result
15041483}
15051484
1506- // effectiveGasPrice computes the transaction gas fee, based on the given basefee value.
1507- //
1508- // price = min(gasTipCap + baseFee, gasFeeCap)
1509- func effectiveGasPrice (tx * types.Transaction , baseFee * big.Int ) * big.Int {
1510- fee := tx .GasTipCap ()
1511- fee = fee .Add (fee , baseFee )
1512- if tx .GasTipCapIntCmp (fee ) < 0 {
1513- return tx .GasTipCap ()
1514- }
1515- return fee
1516- }
1517-
15181485// NewRPCPendingTransaction returns a pending transaction that will serialize to the RPC representation
15191486func NewRPCPendingTransaction (tx * types.Transaction , current * types.Header , config * params.ChainConfig ) * RPCTransaction {
15201487 var (
@@ -1819,11 +1786,6 @@ func marshalReceipt(receipt *types.Receipt, blockHash common.Hash, blockNumber u
18191786 fields ["logs" ] = []* types.Log {}
18201787 }
18211788
1822- if tx .Type () == types .BlobTxType {
1823- fields ["blobGasUsed" ] = hexutil .Uint64 (receipt .BlobGasUsed )
1824- fields ["blobGasPrice" ] = (* hexutil .Big )(receipt .BlobGasPrice )
1825- }
1826-
18271789 // If the ContractAddress is 20 0x0 bytes, assume it is not a contract creation
18281790 if receipt .ContractAddress != (common.Address {}) {
18291791 fields ["contractAddress" ] = receipt .ContractAddress
0 commit comments