pub fn clear_stale(&self, at: &BlockId<B::Block>) -> Result<(), B::Error> {
		let block_number = self.api.block_id_to_number(at)?
				.ok_or_else(|| error::ErrorKind::Msg(format!("Invalid block id: {:?}", at)).into())?
				.as_();
		let now = time::Instant::now();
		let to_remove = {
			self.ready()
				.filter(|tx| self.rotator.ban_if_stale(&now, block_number, &tx))
				.map(|tx| tx.hash.clone())
				.collect::<Vec<_>>()
		};
		let futures_to_remove: Vec<ExHash<B>> = {
			let p = self.pool.read();
			let mut hashes = Vec::new();
			for tx in p.futures() {
				if self.rotator.ban_if_stale(&now, block_number, &tx) {
					hashes.push(tx.hash.clone());
				}
			}
			hashes
		};
		// removing old transactions
		self.remove_invalid(&to_remove);
		self.remove_invalid(&futures_to_remove);
		// clear banned transactions timeouts
		self.rotator.clear_timeouts(&now);

		Ok(())
	}
/// Removes stale transactions from the pool.
///
/// Stale transactions are transaction beyond their longevity period.
/// Note this function does not remove transactions that are already included in the chain.
/// See `prune_tags` ifyou want this.
Removes stale transactions from the pool.
Stale transactions are transaction beyond their longevity period.
Note this function does not remove transactions that are already included in the chain.
See `prune_tags` ifyou want this.
Removes stale transactions from the pool . Stale transactions are transaction beyond their longevity period . Note this function does not remove transactions that are already included in the chain . See ` prune_tags ` ifyou want this .
pub fn clear_stale(&self, at: &BlockId<B::Block>) -> Result<(), B::Error> {
		let block_number = self.api.block_id_to_number(at)?
				.ok_or_else(|| error::ErrorKind::Msg(format!("Invalid block id: {:?}", at)).into())?
				.as_();
		let now = time::Instant::now();
		let to_remove = {
			self.ready()
				.filter(|tx| self.rotator.ban_if_stale(&now, block_number, &tx))
				.map(|tx| tx.hash.clone())
				.collect::<Vec<_>>()
		};
		let futures_to_remove: Vec<ExHash<B>> = {
			let p = self.pool.read();
			let mut hashes = Vec::new();
			for tx in p.futures() {
				if self.rotator.ban_if_stale(&now, block_number, &tx) {
					hashes.push(tx.hash.clone());
				}
			}
			hashes
		};
		// removing old transactions
		self.remove_invalid(&to_remove);
		self.remove_invalid(&futures_to_remove);
		// clear banned transactions timeouts
		self.rotator.clear_timeouts(&now);
		Ok(())
	}
pub fn clear_stale ( & self , at : & BlockId < B :: Block > ) -> Result < ( ) , B :: Error > { let block_number = self . api . block_id_to_number ( at ) ? . ok_or_else ( | | error :: ErrorKind :: Msg ( format ! ( " " at ) ) . into ( ) ) ? . as_ ( ) ; let now = time :: Instant :: now ( ) ; let to_remove = { self . ready ( ) . filter ( | tx | self . rotator . ban_if_stale ( & now , block_number , & tx ) ) . map ( | tx | tx . hash . clone ( ) ) . collect :: < Vec < _ > > ( ) } ; let futures_to_remove : Vec < ExHash < B > > = { let p = self . pool . read ( ) ; let mut hashes = Vec :: new ( ) ; for tx in p . futures ( ) { if self . rotator . ban_if_stale ( & now , block_number , & tx ) { hashes . push ( tx . hash . clone ( ) ) ; } } hashes } ; // removing old transactions self . remove_invalid ( & to_remove ) ; self . remove_invalid ( & futures_to_remove ) ; // clear banned transactions timeouts self . rotator . clear_timeouts ( & now ) ; Ok ( ( ) ) }
Removes stale transactions from the pool.
Removes stale transactions from the pool .
&self
at
&BlockId<B::Block>
&self
at
&BlockId<B::Block>