diff --git a/tx-pool/src/process.rs b/tx-pool/src/process.rs index 61d303b099..90760e3b26 100644 --- a/tx-pool/src/process.rs +++ b/tx-pool/src/process.rs @@ -473,8 +473,9 @@ impl TxPoolService { pub(crate) async fn find_orphan_by_previous(&self, tx: &TransactionView) -> Vec { let orphan = self.orphan.read().await; - let ids = orphan.find_by_previous(tx); - ids.iter() + orphan + .find_by_previous(tx) + .iter() .filter_map(|id| orphan.get(id).cloned()) .collect::>() } @@ -920,24 +921,19 @@ impl TxPoolService { } } - self.remove_orphan_txs_by_attach(attached.iter()).await; + self.remove_orphan_txs_by_attach(&attached).await; { let mut chunk = self.chunk.write().await; chunk.remove_chunk_txs(attached.iter().map(|tx| tx.proposal_short_id())); } } - async fn remove_orphan_txs_by_attach<'a>( - &self, - txs: impl Iterator, - ) { - let mut ids = vec![]; - for tx in txs { - ids.push(tx.proposal_short_id()); + async fn remove_orphan_txs_by_attach<'a>(&self, txs: &LinkedHashSet) { + for tx in txs.iter() { self.process_orphan_tx(tx).await; } let mut orphan = self.orphan.write().await; - orphan.remove_orphan_txs(ids.into_iter()); + orphan.remove_orphan_txs(txs.iter().map(|tx| tx.proposal_short_id())); } fn readd_detached_tx(