From 9ae6e038a9934e7dbbf58b7e4147f9787f668783 Mon Sep 17 00:00:00 2001 From: Matt Whitehead Date: Wed, 8 Nov 2023 11:47:03 +0000 Subject: [PATCH] Reverse sort order (#6106) * Reverse added order and sequence number Signed-off-by: Matthew Whitehead * Remove extraneous 'addedAt' check Signed-off-by: Matthew Whitehead --------- Signed-off-by: Matthew Whitehead (cherry picked from commit 0203092d19146405a6ddd7f18be63c10030627b3) --- .../sorter/GasPricePendingTransactionsSorter.java | 4 ++-- 1 file changed, 2 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..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 @@ -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,7 @@ public class GasPricePendingTransactionsSorter extends AbstractPendingTransactio new TreeSet<>( comparing(PendingTransaction::hasPriority) .thenComparing(PendingTransaction::getGasPrice) - .thenComparing(PendingTransaction::getAddedAt) - .thenComparing(PendingTransaction::getSequence) + .thenComparing(PendingTransaction::getSequence, Comparator.reverseOrder()) .reversed()); public GasPricePendingTransactionsSorter(