mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-14 17:05:06 -05:00
21 lines
756 B
Rust
21 lines
756 B
Rust
use crate::traits::PoolTransaction;
|
|
use std::fmt;
|
|
|
|
/// Transaction ordering trait to determine the order of transactions.
|
|
///
|
|
/// Decides how transactions should be ordered within the pool, depending on a `Priority` value.
|
|
///
|
|
/// The returned priority must reflect [total order](https://en.wikipedia.org/wiki/Total_order).
|
|
pub trait TransactionOrdering: Send + Sync + 'static {
|
|
/// Priority of a transaction.
|
|
///
|
|
/// Higher is better.
|
|
type Priority: Ord + Clone + Default + fmt::Debug + Send + Sync;
|
|
|
|
/// The transaction type to determine the priority of.
|
|
type Transaction: PoolTransaction;
|
|
|
|
/// Returns the priority score for the given transaction.
|
|
fn priority(&self, transaction: &Self::Transaction) -> Self::Priority;
|
|
}
|