core/types: remove duplicated check

This commit is contained in:
Marius van der Wijden 2025-04-10 13:22:23 +02:00
parent a4ad86b280
commit dc3292e403

View file

@ -355,6 +355,9 @@ func (tx *Transaction) GasTipCapIntCmp(other *big.Int) int {
// Note: if the effective gasTipCap is negative, this method returns both error // Note: if the effective gasTipCap is negative, this method returns both error
// the actual negative value, _and_ ErrGasFeeCapTooLow // the actual negative value, _and_ ErrGasFeeCapTooLow
func (tx *Transaction) EffectiveGasTip(baseFee *big.Int) (*big.Int, error) { func (tx *Transaction) EffectiveGasTip(baseFee *big.Int) (*big.Int, error) {
if baseFee == nil {
return tx.inner.gasTipCap(), nil
}
out, err := tx.effectiveGasTip(baseFee) out, err := tx.effectiveGasTip(baseFee)
return new(big.Int).Set(out), err 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 // Note: if the effective gasTipCap is negative, this method returns both error
// the actual negative value, _and_ ErrGasFeeCapTooLow // the actual negative value, _and_ ErrGasFeeCapTooLow
// Note: please copy the return value before modifying. // 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) { func (tx *Transaction) effectiveGasTip(baseFee *big.Int) (*big.Int, error) {
if baseFee == nil {
return tx.inner.gasTipCap(), nil
}
var err error var err error
gasFeeCap := tx.inner.gasFeeCap() gasFeeCap := tx.inner.gasFeeCap()
if gasFeeCap.Cmp(baseFee) < 0 { if gasFeeCap.Cmp(baseFee) < 0 {