File tree Expand file tree Collapse file tree 3 files changed +15
-17
lines changed
crates/transaction-pool/src Expand file tree Collapse file tree 3 files changed +15
-17
lines changed Original file line number Diff line number Diff line change @@ -433,18 +433,19 @@ impl PartialOrd<Self> for BlobOrd {
433
433
}
434
434
435
435
impl Ord for BlobOrd {
436
+ /// Compares two `BlobOrd` instances.
437
+ ///
438
+ /// The comparison is performed in reverse order based on the priority field. This is
439
+ /// because transactions with larger negative values in the priority field will take more fee
440
+ /// jumps, making them take longer to become executable. Therefore, transactions with lower
441
+ /// ordering should return `Greater`, ensuring they are evicted first.
442
+ ///
443
+ /// If the priority values are equal, the submission ID is used to break ties.
436
444
fn cmp ( & self , other : & Self ) -> Ordering {
437
- // order in reverse, so transactions with a lower ordering return Greater - this is
438
- // important because transactions with larger negative values will take more fee jumps and
439
- // it will take longer to become executable, so those should be evicted first
440
- let ord = other. priority . cmp ( & self . priority ) ;
441
-
442
- // use submission_id to break ties
443
- if ord == Ordering :: Equal {
444
- self . submission_id . cmp ( & other. submission_id )
445
- } else {
446
- ord
447
- }
445
+ other
446
+ . priority
447
+ . cmp ( & self . priority )
448
+ . then_with ( || self . submission_id . cmp ( & other. submission_id ) )
448
449
}
449
450
}
450
451
Original file line number Diff line number Diff line change @@ -494,17 +494,15 @@ impl PropagateKind {
494
494
/// Returns the peer the transaction was sent to
495
495
pub const fn peer ( & self ) -> & PeerId {
496
496
match self {
497
- PropagateKind :: Full ( peer) => peer,
498
- PropagateKind :: Hash ( peer) => peer,
497
+ PropagateKind :: Full ( peer) | PropagateKind :: Hash ( peer) => peer,
499
498
}
500
499
}
501
500
}
502
501
503
502
impl From < PropagateKind > for PeerId {
504
503
fn from ( value : PropagateKind ) -> Self {
505
504
match value {
506
- PropagateKind :: Full ( peer) => peer,
507
- PropagateKind :: Hash ( peer) => peer,
505
+ PropagateKind :: Full ( peer) | PropagateKind :: Hash ( peer) => peer,
508
506
}
509
507
}
510
508
}
Original file line number Diff line number Diff line change @@ -126,8 +126,7 @@ impl<T: PoolTransaction> ValidTransaction<T> {
126
126
/// Consumes the wrapper and returns the transaction.
127
127
pub fn into_transaction ( self ) -> T {
128
128
match self {
129
- Self :: Valid ( transaction) => transaction,
130
- Self :: ValidWithSidecar { transaction, .. } => transaction,
129
+ Self :: Valid ( transaction) | Self :: ValidWithSidecar { transaction, .. } => transaction,
131
130
}
132
131
}
133
132
You can’t perform that action at this time.
0 commit comments