fn on_block_finalized<F>(
		&mut self,
		best_finalized_hash: &B::Hash,
		best_finalized_number: NumberFor<B>,
		is_descendent_of: F,
	) -> Result<(), fork_tree::Error<ClientError>>
		where F: Fn(&B::Hash, &B::Hash) -> Result<bool, ClientError>
	{
		if self.importing_requests.contains(&(*best_finalized_hash, best_finalized_number)) {
			// we imported this justification ourselves, so we should get back a response
			// from the import queue through `justification_import_result`
			return Ok(());
		}

		self.justifications.finalize(best_finalized_hash, best_finalized_number, &is_descendent_of)?;

		let roots = self.justifications.roots().collect::<HashSet<_>>();

		self.pending_requests.retain(|(h, n)| roots.contains(&(h, n, &())));
		self.peer_requests.retain(|_, (h, n)| roots.contains(&(h, n, &())));
		self.previous_requests.retain(|(h, n), _| roots.contains(&(h, n, &())));

		Ok(())
	}
/// Removes any pending justification requests for blocks lower than the
/// given best finalized.
Removes any pending justification requests for blocks lower than the
given best finalized.
Removes any pending justification requests for blocks lower than the given best finalized .
fn on_block_finalized<F>(
		&mut self,
		best_finalized_hash: &B::Hash,
		best_finalized_number: NumberFor<B>,
		is_descendent_of: F,
	) -> Result<(), fork_tree::Error<ClientError>>
		where F: Fn(&B::Hash, &B::Hash) -> Result<bool, ClientError>
	{
		if self.importing_requests.contains(&(*best_finalized_hash, best_finalized_number)) {
			// we imported this justification ourselves, so we should get back a response
			// from the import queue through `justification_import_result`
			return Ok(());
		}
		self.justifications.finalize(best_finalized_hash, best_finalized_number, &is_descendent_of)?;
		let roots = self.justifications.roots().collect::<HashSet<_>>();
		self.pending_requests.retain(|(h, n)| roots.contains(&(h, n, &())));
		self.peer_requests.retain(|_, (h, n)| roots.contains(&(h, n, &())));
		self.previous_requests.retain(|(h, n), _| roots.contains(&(h, n, &())));
		Ok(())
	}
fn on_block_finalized < F > ( & mut self , best_finalized_hash : & B :: Hash , best_finalized_number : NumberFor < B > , is_descendent_of : F , ) -> Result < ( ) , fork_tree :: Error < ClientError > > where F : Fn ( & B :: Hash , & B :: Hash ) -> Result < bool , ClientError > { if self . importing_requests . contains ( & ( * best_finalized_hash , best_finalized_number ) ) { // we imported this justification ourselves, so we should get back a response // from the import queue through `justification_import_result` return Ok ( ( ) ) ; } self . justifications . finalize ( best_finalized_hash , best_finalized_number , & is_descendent_of ) ? ; let roots = self . justifications . roots ( ) . collect :: < HashSet < _ > > ( ) ; self . pending_requests . retain ( | ( h , n ) | roots . contains ( & ( h , n , & ( ) ) ) ) ; self . peer_requests . retain ( | _ , ( h , n ) | roots . contains ( & ( h , n , & ( ) ) ) ) ; self . previous_requests . retain ( | ( h , n ) , _ | roots . contains ( & ( h , n , & ( ) ) ) ) ; Ok ( ( ) ) }
Removes any pending justification requests for blocks lower than the
given best finalized.
Removes any pending justification requests for blocks lower than the given best finalized .
&mut self
best_finalized_hash
&B::Hash
best_finalized_number
NumberFor<B>
is_descendent_of
F
&mut self
best_finalized_hash
&B::Hash
best_finalized_number
NumberFor<B>
is_descendent_of
F