From 2374f3b704ac24191b6e615c19057474041c4fad Mon Sep 17 00:00:00 2001 From: Abdelhamid Bakhta <45264458+abdelhamidbakhta@users.noreply.github.com> Date: Mon, 19 Oct 2020 18:47:32 +0200 Subject: [PATCH] Remove restriction about base fee on eth_sendRawTransaction (#1473) Signed-off-by: Abdelhamid Bakhta --- .../eth/transactions/PendingTransactions.java | 5 +++-- .../eth/transactions/TransactionPool.java | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/PendingTransactions.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/PendingTransactions.java index f260453f41..a5bdd84ec8 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/PendingTransactions.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/PendingTransactions.java @@ -273,8 +273,9 @@ public class PendingTransactions { final TransactionInfo existingTransaction = getTrackedTransactionBySenderAndNonce(transactionInfo); if (existingTransaction != null) { - if (!transactionReplacementHandler.shouldReplace( - existingTransaction, transactionInfo, chainHeadHeaderSupplier.get())) { + if (existingTransaction.transaction.isFrontierTransaction() + && !transactionReplacementHandler.shouldReplace( + existingTransaction, transactionInfo, chainHeadHeaderSupplier.get())) { return REJECTED_UNDERPRICED_REPLACEMENT; } removeTransaction(existingTransaction.getTransaction()); diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java index 099d75211d..c13afe5762 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java @@ -160,14 +160,16 @@ public class TransactionPool implements BlockAddedObserver { public ValidationResult addLocalTransaction( final Transaction transaction) { - final Wei transactionGasPrice = minTransactionGasPrice(transaction); - if (transactionGasPrice.compareTo(minTransactionGasPrice) < 0) { - return ValidationResult.invalid(TransactionInvalidReason.GAS_PRICE_TOO_LOW); - } - - if (!configuration.getTxFeeCap().isZero() - && transactionGasPrice.compareTo(configuration.getTxFeeCap()) > 0) { - return ValidationResult.invalid(TransactionInvalidReason.TX_FEECAP_EXCEEDED); + if (transaction.isFrontierTransaction() + && (!ExperimentalEIPs.eip1559Enabled || this.eip1559.isEmpty())) { + final Wei transactionGasPrice = minTransactionGasPrice(transaction); + if (transactionGasPrice.compareTo(minTransactionGasPrice) < 0) { + return ValidationResult.invalid(TransactionInvalidReason.GAS_PRICE_TOO_LOW); + } + if (!configuration.getTxFeeCap().isZero() + && transactionGasPrice.compareTo(configuration.getTxFeeCap()) > 0) { + return ValidationResult.invalid(TransactionInvalidReason.TX_FEECAP_EXCEEDED); + } } final ValidationResult validationResult =