mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-29 09:08:05 -05:00
fix(txpool): queued tx ordering (#1643)
This commit is contained in:
@@ -92,7 +92,6 @@ mod parked;
|
||||
pub(crate) mod pending;
|
||||
pub(crate) mod size;
|
||||
pub(crate) mod state;
|
||||
mod transaction;
|
||||
pub mod txpool;
|
||||
mod update;
|
||||
|
||||
|
||||
@@ -231,8 +231,8 @@ impl<T: PoolTransaction> Ord for BasefeeOrd<T> {
|
||||
/// `Queued` transactions are transactions that are currently blocked by other parked (basefee,
|
||||
/// queued) or missing transactions.
|
||||
///
|
||||
/// The primary order function for is always compares via the timestamp when the transaction was
|
||||
/// created
|
||||
/// The primary order function always compares the transaction costs first. In case these
|
||||
/// are equal, it compares the timestamps when the transactions were created.
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct QueuedOrd<T: PoolTransaction>(Arc<ValidPoolTransaction<T>>);
|
||||
|
||||
@@ -240,6 +240,9 @@ impl_ord_wrapper!(QueuedOrd);
|
||||
|
||||
impl<T: PoolTransaction> Ord for QueuedOrd<T> {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
other.timestamp.cmp(&self.timestamp)
|
||||
// Higher cost is better
|
||||
self.cost.cmp(&other.cost).then_with(||
|
||||
// Lower timestamp is better
|
||||
other.timestamp.cmp(&self.timestamp))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
Reference in New Issue
Block a user