Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Oct 23, 2023
1 parent 3a2f603 commit 2f1f131
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tx-pool/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,14 +428,17 @@ impl TxPoolService {
let orphan = self.orphan.read().await;
let ids = orphan.find_by_previous(tx);
ids.iter()
.map(|id| orphan.get(id).cloned().unwrap())
.filter_map(|id| orphan.get(id).cloned())
.collect::<Vec<_>>()
}

pub(crate) async fn remove_orphan_tx(&self, id: &ProposalShortId) {
self.orphan.write().await.remove_orphan_tx(id);
}

/// Remove all orphans which are resolved by the given transaction
/// the process is like a breath first search, if there is a cycle in `orphan_queue`,
/// `_process_tx` will return `Reject` since we have checked duplicated tx
pub(crate) async fn process_orphan_tx(&self, tx: &TransactionView) {
let mut orphan_queue: VecDeque<TransactionView> = VecDeque::new();
orphan_queue.push_back(tx.clone());
Expand Down

0 comments on commit 2f1f131

Please sign in to comment.