diff --git a/core/types/tx_blob.go b/core/types/tx_blob.go index bbfd3c98db..e5500fbd2e 100644 --- a/core/types/tx_blob.go +++ b/core/types/tx_blob.go @@ -295,11 +295,12 @@ func (tx *BlobTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int { if baseFee == nil { return dst.Set(tx.GasFeeCap.ToBig()) } - tip := dst.Sub(tx.GasFeeCap.ToBig(), baseFee) - if tip.Cmp(tx.GasTipCap.ToBig()) > 0 { - tip.Set(tx.GasTipCap.ToBig()) + effectiveGasPrice := dst.Add(tx.GasTipCap.ToBig(), baseFee) + gasFeeCap := tx.GasFeeCap.ToBig() + if effectiveGasPrice.Cmp(gasFeeCap) > 0 { + effectiveGasPrice.Set(gasFeeCap) } - return tip.Add(tip, baseFee) + return effectiveGasPrice } func (tx *BlobTx) rawSignatureValues() (v, r, s *big.Int) { diff --git a/core/types/tx_dynamic_fee.go b/core/types/tx_dynamic_fee.go index bba81464f8..6cb01389e2 100644 --- a/core/types/tx_dynamic_fee.go +++ b/core/types/tx_dynamic_fee.go @@ -101,11 +101,11 @@ func (tx *DynamicFeeTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.I if baseFee == nil { return dst.Set(tx.GasFeeCap) } - tip := dst.Sub(tx.GasFeeCap, baseFee) - if tip.Cmp(tx.GasTipCap) > 0 { - tip.Set(tx.GasTipCap) + effectiveGasPrice := dst.Add(tx.GasTipCap, baseFee) + if effectiveGasPrice.Cmp(tx.GasFeeCap) > 0 { + effectiveGasPrice.Set(tx.GasFeeCap) } - return tip.Add(tip, baseFee) + return effectiveGasPrice } func (tx *DynamicFeeTx) rawSignatureValues() (v, r, s *big.Int) { diff --git a/core/types/tx_setcode.go b/core/types/tx_setcode.go index 9487c9cc81..4210b07985 100644 --- a/core/types/tx_setcode.go +++ b/core/types/tx_setcode.go @@ -202,11 +202,12 @@ func (tx *SetCodeTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int if baseFee == nil { return dst.Set(tx.GasFeeCap.ToBig()) } - tip := dst.Sub(tx.GasFeeCap.ToBig(), baseFee) - if tip.Cmp(tx.GasTipCap.ToBig()) > 0 { - tip.Set(tx.GasTipCap.ToBig()) + effectiveGasPrice := dst.Add(tx.GasTipCap.ToBig(), baseFee) + gasTipCap := tx.GasFeeCap.ToBig() + if effectiveGasPrice.Cmp(gasTipCap) > 0 { + effectiveGasPrice.Set(gasTipCap) } - return tip.Add(tip, baseFee) + return effectiveGasPrice } func (tx *SetCodeTx) rawSignatureValues() (v, r, s *big.Int) {