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 <abdelhamid.bakhta@consensys.net>
pull/1863/head
Abdelhamid Bakhta 4 years ago committed by GitHub
parent a052148dfd
commit 9934403a97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      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;

Loading…
Cancel
Save