From 98f92ec18b3e852e6a5324ad80fe41358ca134d6 Mon Sep 17 00:00:00 2001 From: Pedro Souto <26165353+jsouto18@users.noreply.github.com> Date: Mon, 13 Jul 2026 16:32:02 +0100 Subject: [PATCH] feat: add public EffectiveGasPrice method to Transaction --- core/types/receipt.go | 2 +- core/types/transaction.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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.