From dc3292e403c877a02435d86b9df0d3cfa26a4193 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Thu, 10 Apr 2025 13:22:23 +0200 Subject: [PATCH] core/types: remove duplicated check --- core/types/transaction.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/types/transaction.go b/core/types/transaction.go index 5c55fbcd0a..916cbf347c 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -355,6 +355,9 @@ func (tx *Transaction) GasTipCapIntCmp(other *big.Int) int { // Note: if the effective gasTipCap is negative, this method returns both error // the actual negative value, _and_ ErrGasFeeCapTooLow func (tx *Transaction) EffectiveGasTip(baseFee *big.Int) (*big.Int, error) { + if baseFee == nil { + return tx.inner.gasTipCap(), nil + } out, err := tx.effectiveGasTip(baseFee) return new(big.Int).Set(out), err } @@ -363,10 +366,8 @@ func (tx *Transaction) EffectiveGasTip(baseFee *big.Int) (*big.Int, error) { // Note: if the effective gasTipCap is negative, this method returns both error // the actual negative value, _and_ ErrGasFeeCapTooLow // Note: please copy the return value before modifying. +// Note: assumes basefee to be non-nil. func (tx *Transaction) effectiveGasTip(baseFee *big.Int) (*big.Int, error) { - if baseFee == nil { - return tx.inner.gasTipCap(), nil - } var err error gasFeeCap := tx.inner.gasFeeCap() if gasFeeCap.Cmp(baseFee) < 0 {