Skip to content

Commit

Permalink
Reverse sort order (hyperledger#6106)
Browse files Browse the repository at this point in the history
* Reverse added order and sequence number

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>

* Remove extraneous 'addedAt' check

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>

---------

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
(cherry picked from commit 0203092)
  • Loading branch information
matthew1001 authored and jflo committed Nov 10, 2023
1 parent ecf8e6e commit 9ae6e03
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(
Expand Down

0 comments on commit 9ae6e03

Please sign in to comment.