diff --git a/core/state_processor.go b/core/state_processor.go index fb7290c077..9601357813 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -334,6 +334,7 @@ func ApplyTransaction(bc ChainContext, author *common.Address, gp *GasPool, stat receipt := types.NewReceipt(root, failedExe, *usedGas) receipt.TxHash = tx.Hash() receipt.GasUsed = result.UsedGas + receipt.EffectiveGasPrice = tx.EffectiveGasPrice(big.NewInt(0), nil) // if the transaction created a contract, store the creation address in the receipt. if msg.To() == nil { receipt.ContractAddress = crypto.CreateAddress(vmenv.Context.Origin, tx.Nonce()) diff --git a/core/types/transaction.go b/core/types/transaction.go index 4461b86506..590c99b8b8 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -536,6 +536,11 @@ func (tx *Transaction) SenderAddress() (common.Address, error) { return addr, nil } +// EffectiveGasPrice returns the effective gas price of the transaction. +func (tx *Transaction) EffectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int { + return tx.data.effectiveGasPrice(dst, baseFee) +} + // TxByNonce implements the sort interface to allow sorting a list of transactions // by their nonces. This is usually only useful for sorting transactions from a // single account, otherwise a nonce comparison doesn't make much sense.