Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(tx-pool): small refactor #12107

Merged
merged 1 commit into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/transaction-pool/src/maintain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ where
// Filter out errors
<P::Transaction as PoolTransaction>::try_from_consensus(tx.into()).ok()
})
.collect::<Vec<_>>();
.collect();

let outcome = pool.add_transactions(crate::TransactionOrigin::Local, pool_transactions).await;

Expand Down
2 changes: 1 addition & 1 deletion crates/transaction-pool/src/pool/best.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl<T: TransactionOrdering> Iterator for BestTransactions<T> {
}
}

/// A[`BestTransactions`](crate::traits::BestTransactions) implementation that filters the
/// A [`BestTransactions`](crate::traits::BestTransactions) implementation that filters the
/// transactions of iter with predicate.
///
/// Filter out transactions are marked as invalid:
Expand Down
15 changes: 7 additions & 8 deletions crates/transaction-pool/src/pool/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::{

/// A set of validated blob transactions in the pool that are __not pending__.
///
/// The purpose of this pool is keep track of blob transactions that are queued and to evict the
/// The purpose of this pool is to keep track of blob transactions that are queued and to evict the
/// worst blob transactions once the sub-pool is full.
///
/// This expects that certain constraints are met:
Expand Down Expand Up @@ -198,14 +198,13 @@ impl<T: PoolTransaction> BlobTransactions<T> {
&mut self,
pending_fees: &PendingFees,
) -> Vec<Arc<ValidPoolTransaction<T>>> {
let to_remove = self.satisfy_pending_fee_ids(pending_fees);

let mut removed = Vec::with_capacity(to_remove.len());
for id in to_remove {
removed.push(self.remove_transaction(&id).expect("transaction exists"));
}
let removed = self
.satisfy_pending_fee_ids(pending_fees)
.into_iter()
.map(|id| self.remove_transaction(&id).expect("transaction exists"))
.collect();

// set pending fees and reprioritize / resort
// Update pending fees and reprioritize
self.pending_fees = pending_fees.clone();
self.reprioritize();

Expand Down
Loading