diff --git a/core/types/receipt.go b/core/types/receipt.go index 0ba5034c68..829cb601b1 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -307,7 +307,7 @@ func (r *Receipt) DeriveFields(signer Signer, context DeriveReceiptContext) { r.GasUsed = context.GasUsed } if context.CollectTips { - r.EffectiveGasPrice = context.Tx.inner.effectiveGasPrice(new(big.Int), context.BaseFee) + r.EffectiveGasPrice = context.Tx.EffectiveGasPrice(context.BaseFee) } else { r.EffectiveGasPrice = context.BaseFee } diff --git a/core/types/transaction.go b/core/types/transaction.go index 337ab4666d..1c0921ef11 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -431,6 +431,11 @@ func (tx *Transaction) GasTipCapIntCmp(other *big.Int) int { return tx.inner.gasTipCap().Cmp(other) } +// EffectiveGasPrice returns the gas price paid by the transaction for the given base fee. +func (tx *Transaction) EffectiveGasPrice(baseFee *big.Int) *big.Int { + return tx.inner.effectiveGasPrice(new(big.Int), baseFee) +} + // EffectiveGasTip returns the effective miner gasTipCap for the given base fee. // Note: if the effective gasTipCap would be negative, this method // returns ErrGasFeeCapTooLow, and value is undefined.