From 52122bd87d2b78c3622c94a8e50776b8547bdc81 Mon Sep 17 00:00:00 2001 From: Tri-stone Date: Thu, 22 Feb 2024 17:49:38 +0800 Subject: [PATCH] [R4R]-[tx]feat: fix tx cost (#41) --- core/types/transaction.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/types/transaction.go b/core/types/transaction.go index d4a6622056..d6f13ec106 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -374,12 +374,13 @@ func (tx *Transaction) IsSystemTx() bool { return tx.inner.isSystemTx() } -// Cost returns gas * gasPrice + value. +// Cost returns (gas * gasPrice) + (blobGas * blobGasPrice) + value. func (tx *Transaction) Cost() *big.Int { total := new(big.Int).Mul(tx.GasPrice(), new(big.Int).SetUint64(tx.Gas())) if tx.Type() == BlobTxType { total.Add(total, new(big.Int).Mul(tx.BlobGasFeeCap(), new(big.Int).SetUint64(tx.BlobGas()))) } + total.Add(total, tx.Value()) return total }