mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-28 00:28:20 -05:00
chore: collect full discarded tx (#4353)
This commit is contained in:
@@ -351,7 +351,7 @@ where
|
||||
let mut listener = self.event_listener.write();
|
||||
|
||||
promoted.iter().for_each(|tx| listener.pending(tx.hash(), None));
|
||||
discarded.iter().for_each(|tx| listener.discarded(tx));
|
||||
discarded.iter().for_each(|tx| listener.discarded(tx.hash()));
|
||||
}
|
||||
|
||||
/// Add a single validated transaction into the pool.
|
||||
@@ -568,7 +568,7 @@ where
|
||||
|
||||
mined.iter().for_each(|tx| listener.mined(tx, block_hash));
|
||||
promoted.iter().for_each(|tx| listener.pending(tx.hash(), None));
|
||||
discarded.iter().for_each(|tx| listener.discarded(tx));
|
||||
discarded.iter().for_each(|tx| listener.discarded(tx.hash()));
|
||||
}
|
||||
|
||||
/// Fire events for the newly added transaction if there are any.
|
||||
@@ -581,7 +581,7 @@ where
|
||||
|
||||
listener.pending(transaction.hash(), replaced.clone());
|
||||
promoted.iter().for_each(|tx| listener.pending(tx.hash(), None));
|
||||
discarded.iter().for_each(|tx| listener.discarded(tx));
|
||||
discarded.iter().for_each(|tx| listener.discarded(tx.hash()));
|
||||
}
|
||||
AddedTransaction::Parked { transaction, replaced, .. } => {
|
||||
listener.queued(transaction.hash());
|
||||
@@ -755,7 +755,7 @@ pub struct AddedPendingTransaction<T: PoolTransaction> {
|
||||
/// transactions promoted to the pending queue
|
||||
promoted: Vec<Arc<ValidPoolTransaction<T>>>,
|
||||
/// transaction that failed and became discarded
|
||||
discarded: Vec<TxHash>,
|
||||
discarded: Vec<Arc<ValidPoolTransaction<T>>>,
|
||||
}
|
||||
|
||||
impl<T: PoolTransaction> AddedPendingTransaction<T> {
|
||||
@@ -871,7 +871,7 @@ pub(crate) struct OnNewCanonicalStateOutcome<T: PoolTransaction> {
|
||||
/// Transactions promoted to the ready queue.
|
||||
pub(crate) promoted: Vec<Arc<ValidPoolTransaction<T>>>,
|
||||
/// transaction that were discarded during the update
|
||||
pub(crate) discarded: Vec<TxHash>,
|
||||
pub(crate) discarded: Vec<Arc<ValidPoolTransaction<T>>>,
|
||||
}
|
||||
|
||||
impl<T: PoolTransaction> OnNewCanonicalStateOutcome<T> {
|
||||
|
||||
@@ -416,8 +416,9 @@ impl<T: TransactionOrdering> TxPool<T> {
|
||||
match destination {
|
||||
Destination::Discard => {
|
||||
// remove the transaction from the pool and subpool
|
||||
self.prune_transaction_by_hash(&hash);
|
||||
outcome.discarded.push(hash);
|
||||
if let Some(tx) = self.prune_transaction_by_hash(&hash) {
|
||||
outcome.discarded.push(tx);
|
||||
}
|
||||
self.metrics.removed_transactions.increment(1);
|
||||
}
|
||||
Destination::Pool(move_to) => {
|
||||
@@ -1336,7 +1337,7 @@ pub(crate) struct UpdateOutcome<T: PoolTransaction> {
|
||||
/// transactions promoted to the pending pool
|
||||
pub(crate) promoted: Vec<Arc<ValidPoolTransaction<T>>>,
|
||||
/// transaction that failed and were discarded
|
||||
pub(crate) discarded: Vec<TxHash>,
|
||||
pub(crate) discarded: Vec<Arc<ValidPoolTransaction<T>>>,
|
||||
}
|
||||
|
||||
impl<T: PoolTransaction> Default for UpdateOutcome<T> {
|
||||
|
||||
Reference in New Issue
Block a user