From 6fd6cec6aee32a81c4844f4b0827520d3f2ee00f Mon Sep 17 00:00:00 2001 From: Karl Bartel Date: Wed, 10 Jan 2024 15:30:02 +0100 Subject: [PATCH] rpc: return effective gas price from receipt This will give us the correct result for fee currency txs. The old approach was necessary when the code was written because receipts did not contain the effective gas price back then. This change could be upstreamed, if it works as expected. --- internal/ethapi/api.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index b129290735..cd481db974 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1648,9 +1648,8 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber result.GasFeeCap = (*hexutil.Big)(tx.GasFeeCap()) result.GasTipCap = (*hexutil.Big)(tx.GasTipCap()) // if the transaction has been mined, compute the effective gas price - if baseFee != nil && blockHash != (common.Hash{}) { - // price = min(gasTipCap + baseFee, gasFeeCap) - result.GasPrice = (*hexutil.Big)(effectiveGasPrice(tx, baseFee)) + if receipt != nil { + result.GasPrice = (*hexutil.Big)(receipt.EffectiveGasPrice) } else { result.GasPrice = (*hexutil.Big)(tx.GasFeeCap()) }