From 12eb3d5b52a07bb441eaa09a52c83bb2c70f2611 Mon Sep 17 00:00:00 2001 From: Matthew Whitehead Date: Mon, 30 Oct 2023 12:59:49 +0000 Subject: [PATCH 1/2] Reverse added order and sequence number Signed-off-by: Matthew Whitehead --- .../sorter/GasPricePendingTransactionsSorter.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/GasPricePendingTransactionsSorter.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/GasPricePendingTransactionsSorter.java index ce8f8802592..dd5529b2c45 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/GasPricePendingTransactionsSorter.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/GasPricePendingTransactionsSorter.java @@ -22,6 +22,7 @@ import org.hyperledger.besu.plugin.services.MetricsSystem; import java.time.Clock; +import java.util.Comparator; import java.util.Iterator; import java.util.NavigableSet; import java.util.TreeSet; @@ -39,8 +40,8 @@ public class GasPricePendingTransactionsSorter extends AbstractPendingTransactio new TreeSet<>( comparing(PendingTransaction::hasPriority) .thenComparing(PendingTransaction::getGasPrice) - .thenComparing(PendingTransaction::getAddedAt) - .thenComparing(PendingTransaction::getSequence) + .thenComparing(PendingTransaction::getAddedAt, Comparator.reverseOrder()) + .thenComparing(PendingTransaction::getSequence, Comparator.reverseOrder()) .reversed()); public GasPricePendingTransactionsSorter( From 9b0971ff72fb364c174b5c91ba57649adb5efa66 Mon Sep 17 00:00:00 2001 From: Matthew Whitehead Date: Wed, 8 Nov 2023 10:53:04 +0000 Subject: [PATCH 2/2] Remove extraneous 'addedAt' check Signed-off-by: Matthew Whitehead --- .../transactions/sorter/GasPricePendingTransactionsSorter.java | 1 - 1 file changed, 1 deletion(-) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/GasPricePendingTransactionsSorter.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/GasPricePendingTransactionsSorter.java index dd5529b2c45..4726574a406 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/GasPricePendingTransactionsSorter.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/GasPricePendingTransactionsSorter.java @@ -40,7 +40,6 @@ public class GasPricePendingTransactionsSorter extends AbstractPendingTransactio new TreeSet<>( comparing(PendingTransaction::hasPriority) .thenComparing(PendingTransaction::getGasPrice) - .thenComparing(PendingTransaction::getAddedAt, Comparator.reverseOrder()) .thenComparing(PendingTransaction::getSequence, Comparator.reverseOrder()) .reversed());