pub fn prune_tags(
		&self,
		at: &BlockId<B::Block>,
		tags: impl IntoIterator<Item=Tag>,
		known_imported_hashes: impl IntoIterator<Item=ExHash<B>> + Clone,
	) -> Result<(), B::Error> {
		// Perform tag-based pruning in the base pool
		let status = self.pool.write().prune_tags(tags);
		// Notify event listeners of all transactions
		// that were promoted to `Ready` or were dropped.
		{
			let mut listener = self.listener.write();
			for promoted in &status.promoted {
				fire_events(&mut *listener, promoted);
			}
			for f in &status.failed {
				listener.dropped(f, None);
			}
		}
		// make sure that we don't revalidate extrinsics that were part of the recently
		// imported block. This is especially important for UTXO-like chains cause the
		// inputs are pruned so such transaction would go to future again.
		self.rotator.ban(&std::time::Instant::now(), known_imported_hashes.clone().into_iter());

		// try to re-submit pruned transactions since some of them might be still valid.
		// note that `known_imported_hashes` will be rejected here due to temporary ban.
		let hashes = status.pruned.iter().map(|tx| tx.hash.clone()).collect::<Vec<_>>();
		let results = self.submit_at(at, status.pruned.into_iter().map(|tx| tx.data.clone()))?;

		// Collect the hashes of transactions that now became invalid (meaning that they are succesfuly pruned).
		let hashes = results.into_iter().enumerate().filter_map(|(idx, r)| match r.map_err(error::IntoPoolError::into_pool_error) {
			Err(Ok(err)) => match err.kind() {
				error::ErrorKind::InvalidTransaction(_) => Some(hashes[idx].clone()),
				_ => None,
			},
			_ => None,
		});
		// Fire `pruned` notifications for collected hashes and make sure to include
		// `known_imported_hashes` since they were just imported as part of the block.
		let hashes = hashes.chain(known_imported_hashes.into_iter());
		{
			let header_hash = self.api.block_id_to_hash(at)?
				.ok_or_else(|| error::ErrorKind::Msg(format!("Invalid block id: {:?}", at)).into())?;
			let mut listener = self.listener.write();
			for h in hashes {
				listener.pruned(header_hash, &h);
			}
		}
		// perform regular cleanup of old transactions in the pool
		// and update temporary bans.
		self.clear_stale(at)?;
		Ok(())
	}
/// Prunes ready transactions that provide given list of tags.
///
/// Given tags are assumed to be always provided now, so all transactions
/// in the Future Queue that require that particular tag (and have other
/// requirements satisfied) are promoted to Ready Queue.
///
/// Moreover for each provided tag we remove transactions in the pool that:
/// 1. Provide that tag directly
/// 2. Are a dependency of pruned transaction.
///
/// By removing predecessor transactions as well we might actually end up
/// pruning too much, so all removed transactions are reverified against
/// the runtime (`validate_transaction`) to make sure they are invalid.
///
/// However we avoid revalidating transactions that are contained within
/// the second parameter of `known_imported_hashes`. These transactions
/// (if pruned) are not revalidated and become temporarily banned to
/// prevent importing them in the (near) future.
Prunes ready transactions that provide given list of tags.
Given tags are assumed to be always provided now, so all transactions
in the Future Queue that require that particular tag (and have other
requirements satisfied) are promoted to Ready Queue.

Moreover for each provided tag we remove transactions in the pool that:
1. Provide that tag directly
2. Are a dependency of pruned transaction.

By removing predecessor transactions as well we might actually end up
pruning too much, so all removed transactions are reverified against
the runtime (`validate_transaction`) to make sure they are invalid.

However we avoid revalidating transactions that are contained within
the second parameter of `known_imported_hashes`. These transactions
(if pruned) are not revalidated and become temporarily banned to
prevent importing them in the (near) future.
Prunes ready transactions that provide given list of tags . Given tags are assumed to be always provided now so all transactions in the Future Queue that require that particular tag ( and have other requirements satisfied ) are promoted to Ready Queue . Moreover for each provided tag we remove transactions in the pool that : 1 . Provide that tag directly 2 . Are a dependency of pruned transaction . By removing predecessor transactions as well we might actually end up pruning too much so all removed transactions are reverified against the runtime ( ` validate_transaction ` ) to make sure they are invalid . However we avoid revalidating transactions that are contained within the second parameter of ` known_imported_hashes ` . These transactions ( if pruned ) are not revalidated and become temporarily banned to prevent importing them in the ( near ) future .
pub fn prune_tags(
		&self,
		at: &BlockId<B::Block>,
		tags: impl IntoIterator<Item=Tag>,
		known_imported_hashes: impl IntoIterator<Item=ExHash<B>> + Clone,
	) -> Result<(), B::Error> {
		// Perform tag-based pruning in the base pool
		let status = self.pool.write().prune_tags(tags);
		// Notify event listeners of all transactions
		// that were promoted to `Ready` or were dropped.
		{
			let mut listener = self.listener.write();
			for promoted in &status.promoted {
				fire_events(&mut *listener, promoted);
			}
			for f in &status.failed {
				listener.dropped(f, None);
			}
		}
		// make sure that we don't revalidate extrinsics that were part of the recently
		// imported block. This is especially important for UTXO-like chains cause the
		// inputs are pruned so such transaction would go to future again.
		self.rotator.ban(&std::time::Instant::now(), known_imported_hashes.clone().into_iter());
		// try to re-submit pruned transactions since some of them might be still valid.
		// note that `known_imported_hashes` will be rejected here due to temporary ban.
		let hashes = status.pruned.iter().map(|tx| tx.hash.clone()).collect::<Vec<_>>();
		let results = self.submit_at(at, status.pruned.into_iter().map(|tx| tx.data.clone()))?;
		// Collect the hashes of transactions that now became invalid (meaning that they are succesfuly pruned).
		let hashes = results.into_iter().enumerate().filter_map(|(idx, r)| match r.map_err(error::IntoPoolError::into_pool_error) {
			Err(Ok(err)) => match err.kind() {
				error::ErrorKind::InvalidTransaction(_) => Some(hashes[idx].clone()),
				_ => None,
			},
			_ => None,
		});
		// Fire `pruned` notifications for collected hashes and make sure to include
		// `known_imported_hashes` since they were just imported as part of the block.
		let hashes = hashes.chain(known_imported_hashes.into_iter());
		{
			let header_hash = self.api.block_id_to_hash(at)?
				.ok_or_else(|| error::ErrorKind::Msg(format!("Invalid block id: {:?}", at)).into())?;
			let mut listener = self.listener.write();
			for h in hashes {
				listener.pruned(header_hash, &h);
			}
		}
		// perform regular cleanup of old transactions in the pool
		// and update temporary bans.
		self.clear_stale(at)?;
		Ok(())
	}
pub fn prune_tags ( & self , at : & BlockId < B :: Block > , tags : impl IntoIterator < Item = Tag > , known_imported_hashes : impl IntoIterator < Item = ExHash < B > > + Clone , ) -> Result < ( ) , B :: Error > { // Perform tag-based pruning in the base pool let status = self . pool . write ( ) . prune_tags ( tags ) ; // Notify event listeners of all transactions // that were promoted to `Ready` or were dropped. { let mut listener = self . listener . write ( ) ; for promoted in & status . promoted { fire_events ( & mut * listener , promoted ) ; } for f in & status . failed { listener . dropped ( f , None ) ; } } // make sure that we don't revalidate extrinsics that were part of the recently // imported block. This is especially important for UTXO-like chains cause the // inputs are pruned so such transaction would go to future again. self . rotator . ban ( & std :: time :: Instant :: now ( ) , known_imported_hashes . clone ( ) . into_iter ( ) ) ; // try to re-submit pruned transactions since some of them might be still valid. // note that `known_imported_hashes` will be rejected here due to temporary ban. let hashes = status . pruned . iter ( ) . map ( | tx | tx . hash . clone ( ) ) . collect :: < Vec < _ > > ( ) ; let results = self . submit_at ( at , status . pruned . into_iter ( ) . map ( | tx | tx . data . clone ( ) ) ) ? ; // Collect the hashes of transactions that now became invalid (meaning that they are succesfuly pruned). let hashes = results . into_iter ( ) . enumerate ( ) . filter_map ( | ( idx , r ) | match r . map_err ( error :: IntoPoolError :: into_pool_error ) { Err ( Ok ( err ) ) => match err . kind ( ) { error :: ErrorKind :: InvalidTransaction ( _ ) => Some ( hashes [ idx ] . clone ( ) ) , _ => None , } , _ => None , } ) ; // Fire `pruned` notifications for collected hashes and make sure to include // `known_imported_hashes` since they were just imported as part of the block. let hashes = hashes . chain ( known_imported_hashes . into_iter ( ) ) ; { let header_hash = self . api . block_id_to_hash ( at ) ? . ok_or_else ( | | error :: ErrorKind :: Msg ( format ! ( " " at ) ) . into ( ) ) ? ; let mut listener = self . listener . write ( ) ; for h in hashes { listener . pruned ( header_hash , & h ) ; } } // perform regular cleanup of old transactions in the pool // and update temporary bans. self . clear_stale ( at ) ? ; Ok ( ( ) ) }
Prunes ready transactions that provide given list of tags.
Prunes ready transactions that provide given list of tags .
&self
at
&BlockId<B::Block>
tags
impl IntoIterator<Item=Tag>
known_imported_hashes
impl IntoIterator<Item=ExHash<B>> + Clone
&self
at
&BlockId<B::Block>
tags
impl IntoIterator<Item=Tag>
known_imported_hashes
impl IntoIterator<Item=ExHash<B>> + Clone