pub fn prune(&self, at: &BlockId<B::Block>, parent: &BlockId<B::Block>, extrinsics: &[ExtrinsicFor<B>]) -> Result<(), B::Error> {
		let mut tags = Vec::with_capacity(extrinsics.len());
		// Get details of all extrinsics that are already in the pool
		let hashes = extrinsics.iter().map(|extrinsic| self.api.hash_and_length(extrinsic).0).collect::<Vec<_>>();
		let in_pool = self.pool.read().by_hash(&hashes);
		{
			// Zip the ones from the pool with the full list (we get pairs `(Extrinsic, Option<TransactionDetails>)`)
			let all = extrinsics.iter().zip(in_pool.iter());

			for (extrinsic, existing_in_pool) in all {
				match *existing_in_pool {
					// reuse the tags for extrinsis that were found in the pool
					Some(ref transaction) => {
						tags.extend(transaction.provides.iter().cloned());
					},
					// if it's not found in the pool query the runtime at parent block
					// to get validity info and tags that the extrinsic provides.
					None => {
						let validity = self.api.validate_transaction(parent, extrinsic.clone());
						match validity {
							Ok(TransactionValidity::Valid { mut provides, .. }) => {
								tags.append(&mut provides);
							},
							// silently ignore invalid extrinsics,
							// cause they might just be inherent
							_ => {}
						}
					},
				}
			}
		}

		self.prune_tags(at, tags, in_pool.into_iter().filter_map(|x| x).map(|x| x.hash.clone()))?;

		Ok(())
	}
/// Prunes ready transactions.
///
/// Used to clear the pool from transactions that were part of recently imported block.
/// To perform pruning we need the tags that each extrinsic provides and to avoid calling
/// into runtime too often we first lookup all extrinsics that are in the pool and get
/// their provided tags from there. Otherwise we query the runtime at the `parent` block.
Prunes ready transactions.
Used to clear the pool from transactions that were part of recently imported block.
To perform pruning we need the tags that each extrinsic provides and to avoid calling
into runtime too often we first lookup all extrinsics that are in the pool and get
their provided tags from there. Otherwise we query the runtime at the `parent` block.
Prunes ready transactions . Used to clear the pool from transactions that were part of recently imported block . To perform pruning we need the tags that each extrinsic provides and to avoid calling into runtime too often we first lookup all extrinsics that are in the pool and get their provided tags from there . Otherwise we query the runtime at the ` parent ` block .
pub fn prune(&self, at: &BlockId<B::Block>, parent: &BlockId<B::Block>, extrinsics: &[ExtrinsicFor<B>]) -> Result<(), B::Error> {
		let mut tags = Vec::with_capacity(extrinsics.len());
		// Get details of all extrinsics that are already in the pool
		let hashes = extrinsics.iter().map(|extrinsic| self.api.hash_and_length(extrinsic).0).collect::<Vec<_>>();
		let in_pool = self.pool.read().by_hash(&hashes);
		{
			// Zip the ones from the pool with the full list (we get pairs `(Extrinsic, Option<TransactionDetails>)`)
			let all = extrinsics.iter().zip(in_pool.iter());
			for (extrinsic, existing_in_pool) in all {
				match *existing_in_pool {
					// reuse the tags for extrinsis that were found in the pool
					Some(ref transaction) => {
						tags.extend(transaction.provides.iter().cloned());
					},
					// if it's not found in the pool query the runtime at parent block
					// to get validity info and tags that the extrinsic provides.
					None => {
						let validity = self.api.validate_transaction(parent, extrinsic.clone());
						match validity {
							Ok(TransactionValidity::Valid { mut provides, .. }) => {
								tags.append(&mut provides);
							},
							// silently ignore invalid extrinsics,
							// cause they might just be inherent
							_ => {}
						}
					},
				}
			}
		}
		self.prune_tags(at, tags, in_pool.into_iter().filter_map(|x| x).map(|x| x.hash.clone()))?;
		Ok(())
	}
pub fn prune ( & self , at : & BlockId < B :: Block > , parent : & BlockId < B :: Block > , extrinsics : & [ ExtrinsicFor < B > ] ) -> Result < ( ) , B :: Error > { let mut tags = Vec :: with_capacity ( extrinsics . len ( ) ) ; // Get details of all extrinsics that are already in the pool let hashes = extrinsics . iter ( ) . map ( | extrinsic | self . api . hash_and_length ( extrinsic ) . 0 ) . collect :: < Vec < _ > > ( ) ; let in_pool = self . pool . read ( ) . by_hash ( & hashes ) ; { // Zip the ones from the pool with the full list (we get pairs `(Extrinsic, Option<TransactionDetails>)`) let all = extrinsics . iter ( ) . zip ( in_pool . iter ( ) ) ; for ( extrinsic , existing_in_pool ) in all { match * existing_in_pool { // reuse the tags for extrinsis that were found in the pool Some ( ref transaction ) => { tags . extend ( transaction . provides . iter ( ) . cloned ( ) ) ; } , // if it's not found in the pool query the runtime at parent block // to get validity info and tags that the extrinsic provides. None => { let validity = self . api . validate_transaction ( parent , extrinsic . clone ( ) ) ; match validity { Ok ( TransactionValidity :: Valid { mut provides , .. } ) => { tags . append ( & mut provides ) ; } , // silently ignore invalid extrinsics, // cause they might just be inherent _ => { } } } , } } } self . prune_tags ( at , tags , in_pool . into_iter ( ) . filter_map ( | x | x ) . map ( | x | x . hash . clone ( ) ) ) ? ; Ok ( ( ) ) }
Prunes ready transactions.
Prunes ready transactions .
&self
at
&BlockId<B::Block>
parent
&BlockId<B::Block>
extrinsics
&[ExtrinsicFor<B>]
&self
at
&BlockId<B::Block>
parent
&BlockId<B::Block>
extrinsics
&[ExtrinsicFor<B>]