Bugfix concurrent legacy transaction eviction in BaseFee txpool (#4390)

* make static range comparator safe for non-1559 transactions

Signed-off-by: garyschulte <garyschulte@gmail.com>

* spotless, and rebase

Signed-off-by: garyschulte <garyschulte@gmail.com>

Signed-off-by: garyschulte <garyschulte@gmail.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/4410/head
garyschulte 2 years ago committed by GitHub
parent 4691bfdba7
commit 240a4811f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/BaseFeePendingTransactionsSorter.java

@ -72,8 +72,8 @@ public class BaseFeePendingTransactionsSorter extends AbstractPendingTransaction
transactionInfo
.getTransaction()
.getMaxPriorityFeePerGas()
// safe to .get() here because only 1559 txs can be in the static range
.get()
// just in case we attempt to compare non-1559 transaction
.orElse(Wei.ZERO)
.getAsBigInteger()
.longValue())
.thenComparing(TransactionInfo::getAddedToPoolAt)
@ -104,7 +104,10 @@ public class BaseFeePendingTransactionsSorter extends AbstractPendingTransaction
pendingTransactions.remove(transaction.getHash());
if (removedTransactionInfo != null) {
if (!prioritizedTransactionsDynamicRange.remove(removedTransactionInfo))
prioritizedTransactionsStaticRange.remove(removedTransactionInfo);
removedTransactionInfo
.getTransaction()
.getMaxPriorityFeePerGas()
.ifPresent(__ -> prioritizedTransactionsStaticRange.remove(removedTransactionInfo));
removeTransactionTrackedBySenderAndNonce(transaction);
incrementTransactionRemovedCounter(
removedTransactionInfo.isReceivedFromLocalSource(), addedToBlock);

Loading…
Cancel
Save