pub fn remove_invalid(&mut self, hashes: &[Hash]) -> Vec<Arc<Transaction<Hash, Ex>>> {
		let mut removed = vec![];
		let mut to_remove = hashes.iter().cloned().collect::<Vec<_>>();

		let mut ready = self.ready.write();
		loop {
			let hash = match to_remove.pop() {
				Some(hash) => hash,
				None => return removed,
			};

			if let Some(mut tx) = ready.remove(&hash) {
				// remove entries from provided_tags
				for tag in &tx.transaction.transaction.provides {
					self.provided_tags.remove(tag);
				}
				// remove from unlocks
				for tag in &tx.transaction.transaction.requires {
					if let Some(hash) = self.provided_tags.get(tag) {
						if let Some(tx) = ready.get_mut(hash) {
							remove_item(&mut tx.unlocks, &hash);
						}
					}
				}

				// remove from best
				self.best.remove(&tx.transaction);

				// remove all transactions that the current one unlocks
				to_remove.append(&mut tx.unlocks);

				// add to removed
				debug!(target: "txpool", "[{:?}] Removed as invalid: ", hash);
				removed.push(tx.transaction.transaction);
			}
		}
	}
/// Removes invalid transactions from the ready pool.
///
/// NOTE removing a transaction will also cause a removal of all transactions that depend on that one
/// (i.e. the entire subgraph that this transaction is a start of will be removed).
/// All removed transactions are returned.
Removes invalid transactions from the ready pool.
NOTE removing a transaction will also cause a removal of all transactions that depend on that one
.
All removed transactions are returned.
Removes invalid transactions from the ready pool . NOTE removing a transaction will also cause a removal of all transactions that depend on that one . All removed transactions are returned .
pub fn remove_invalid(&mut self, hashes: &[Hash]) -> Vec<Arc<Transaction<Hash, Ex>>> {
		let mut removed = vec![];
		let mut to_remove = hashes.iter().cloned().collect::<Vec<_>>();
		let mut ready = self.ready.write();
		loop {
			let hash = match to_remove.pop() {
				Some(hash) => hash,
				None => return removed,
			};
			if let Some(mut tx) = ready.remove(&hash) {
				// remove entries from provided_tags
				for tag in &tx.transaction.transaction.provides {
					self.provided_tags.remove(tag);
				}
				// remove from unlocks
				for tag in &tx.transaction.transaction.requires {
					if let Some(hash) = self.provided_tags.get(tag) {
						if let Some(tx) = ready.get_mut(hash) {
							remove_item(&mut tx.unlocks, &hash);
						}
					}
				}
				// remove from best
				self.best.remove(&tx.transaction);
				// remove all transactions that the current one unlocks
				to_remove.append(&mut tx.unlocks);
				// add to removed
				debug!(target: "txpool", "[{:?}] Removed as invalid: ", hash);
				removed.push(tx.transaction.transaction);
			}
		}
	}
pub fn remove_invalid ( & mut self , hashes : & [ Hash ] ) -> Vec < Arc < Transaction < Hash , Ex > > > { let mut removed = vec ! [ ] ; let mut to_remove = hashes . iter ( ) . cloned ( ) . collect :: < Vec < _ > > ( ) ; let mut ready = self . ready . write ( ) ; loop { let hash = match to_remove . pop ( ) { Some ( hash ) => hash , None => return removed , } ; if let Some ( mut tx ) = ready . remove ( & hash ) { // remove entries from provided_tags for tag in & tx . transaction . transaction . provides { self . provided_tags . remove ( tag ) ; } // remove from unlocks for tag in & tx . transaction . transaction . requires { if let Some ( hash ) = self . provided_tags . get ( tag ) { if let Some ( tx ) = ready . get_mut ( hash ) { remove_item ( & mut tx . unlocks , & hash ) ; } } } // remove from best self . best . remove ( & tx . transaction ) ; // remove all transactions that the current one unlocks to_remove . append ( & mut tx . unlocks ) ; // add to removed debug ! ( target " " " " hash ) ; removed . push ( tx . transaction . transaction ) ; } } }
Removes invalid transactions from the ready pool.
Removes invalid transactions from the ready pool .
&mut self
hashes
&[Hash]
&mut self
hashes
&[Hash]