diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/fees/TransactionPriceCalculator.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/fees/TransactionPriceCalculator.java index bc41d42210..13db6b369c 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/fees/TransactionPriceCalculator.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/fees/TransactionPriceCalculator.java @@ -32,14 +32,14 @@ public interface TransactionPriceCalculator { static TransactionPriceCalculator eip1559() { return (transaction, maybeBaseFee) -> { + ExperimentalEIPs.eip1559MustBeEnabled(); + final Wei baseFee = Wei.of(maybeBaseFee.orElseThrow()); if (transaction.getType().equals(TransactionType.FRONTIER)) { return transaction.getGasPrice(); } - ExperimentalEIPs.eip1559MustBeEnabled(); final Wei gasPremium = Wei.of((BigInteger) transaction.getGasPremium().orElseThrow().getValue()); final Wei feeCap = Wei.of((BigInteger) transaction.getFeeCap().orElseThrow().getValue()); - final Wei baseFee = Wei.of(maybeBaseFee.orElseThrow()); Wei price = gasPremium.add(baseFee); if (price.compareTo(feeCap) > 0) { price = feeCap;