From 9934403a97ec1453b5bd921bbb4410faed8a3a0c Mon Sep 17 00:00:00 2001 From: Abdelhamid Bakhta <45264458+abdelhamidbakhta@users.noreply.github.com> Date: Mon, 1 Feb 2021 16:09:13 +0100 Subject: [PATCH] Account the effective gas price for frontier transactions after EIP-1559 fork (#1862) * fix consensus issue. ensure that gas price is greater than base fee for frontier transactions Signed-off-by: Abdelhamid Bakhta --- .../besu/ethereum/core/fees/TransactionPriceCalculator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;