fn note_finalized(
		&self,
		transaction: &mut DBTransaction,
		f_header: &Block::Header,
		f_hash: Block::Hash,
		displaced: &mut Option<FinalizationDisplaced<Block::Hash, NumberFor<Block>>>
	) -> Result<(), client::error::Error> where
		Block: BlockT<Hash=H256>,
	{
		let f_num = f_header.number().clone();

		if self.storage.state_db.best_canonical().map(|c| f_num.as_() > c).unwrap_or(true) {
			let parent_hash = f_header.parent_hash().clone();

			let lookup_key = utils::number_and_hash_to_lookup_key(f_num, f_hash.clone());
			transaction.put(columns::META, meta_keys::FINALIZED_BLOCK, &lookup_key);

			let commit = self.storage.state_db.canonicalize_block(&f_hash)
				.map_err(|e: state_db::Error<io::Error>| client::error::Error::from(format!("State database error: {:?}", e)))?;
			apply_state_commit(transaction, commit);

			let changes_trie_config = self.changes_trie_config(parent_hash)?;
			if let Some(changes_trie_config) = changes_trie_config {
				self.changes_tries_storage.prune(&changes_trie_config, transaction, f_hash, f_num);
			}
		}

		let new_displaced = self.blockchain.leaves.write().finalize_height(f_num);
		match displaced {
			x @ &mut None => *x = Some(new_displaced),
			&mut Some(ref mut displaced) => displaced.merge(new_displaced),
		}

		Ok(())
	}
// write stuff to a transaction after a new block is finalized.
// this canonicalizes finalized blocks. Fails if called with a block which
// was not a child of the last finalized block.
write stuff to a transaction after a new block is finalized.
this canonicalizes finalized blocks. Fails if called with a block which
was not a child of the last finalized block.
write stuff to a transaction after a new block is finalized . this canonicalizes finalized blocks . Fails if called with a block which was not a child of the last finalized block .
fn note_finalized(
		&self,
		transaction: &mut DBTransaction,
		f_header: &Block::Header,
		f_hash: Block::Hash,
		displaced: &mut Option<FinalizationDisplaced<Block::Hash, NumberFor<Block>>>
	) -> Result<(), client::error::Error> where
		Block: BlockT<Hash=H256>,
	{
		let f_num = f_header.number().clone();
		if self.storage.state_db.best_canonical().map(|c| f_num.as_() > c).unwrap_or(true) {
			let parent_hash = f_header.parent_hash().clone();
			let lookup_key = utils::number_and_hash_to_lookup_key(f_num, f_hash.clone());
			transaction.put(columns::META, meta_keys::FINALIZED_BLOCK, &lookup_key);
			let commit = self.storage.state_db.canonicalize_block(&f_hash)
				.map_err(|e: state_db::Error<io::Error>| client::error::Error::from(format!("State database error: {:?}", e)))?;
			apply_state_commit(transaction, commit);
			let changes_trie_config = self.changes_trie_config(parent_hash)?;
			if let Some(changes_trie_config) = changes_trie_config {
				self.changes_tries_storage.prune(&changes_trie_config, transaction, f_hash, f_num);
			}
		}
		let new_displaced = self.blockchain.leaves.write().finalize_height(f_num);
		match displaced {
			x @ &mut None => *x = Some(new_displaced),
			&mut Some(ref mut displaced) => displaced.merge(new_displaced),
		}
		Ok(())
	}
fn note_finalized ( & self , transaction : & mut DBTransaction , f_header : & Block :: Header , f_hash : Block :: Hash , displaced : & mut Option < FinalizationDisplaced < Block :: Hash , NumberFor < Block > > > ) -> Result < ( ) , client :: error :: Error > where Block : BlockT < Hash = H256 > , { let f_num = f_header . number ( ) . clone ( ) ; if self . storage . state_db . best_canonical ( ) . map ( | c | f_num . as_ ( ) > c ) . unwrap_or ( true ) { let parent_hash = f_header . parent_hash ( ) . clone ( ) ; let lookup_key = utils :: number_and_hash_to_lookup_key ( f_num , f_hash . clone ( ) ) ; transaction . put ( columns :: META , meta_keys :: FINALIZED_BLOCK , & lookup_key ) ; let commit = self . storage . state_db . canonicalize_block ( & f_hash ) . map_err ( | e : state_db :: Error < io :: Error > | client :: error :: Error :: from ( format ! ( " " e ) ) ) ? ; apply_state_commit ( transaction , commit ) ; let changes_trie_config = self . changes_trie_config ( parent_hash ) ? ; if let Some ( changes_trie_config ) = changes_trie_config { self . changes_tries_storage . prune ( & changes_trie_config , transaction , f_hash , f_num ) ; } } let new_displaced = self . blockchain . leaves . write ( ) . finalize_height ( f_num ) ; match displaced { x @ & mut None => * x = Some ( new_displaced ) , & mut Some ( ref mut displaced ) => displaced . merge ( new_displaced ) , } Ok ( ( ) ) }
write stuff to a transaction after a new block is finalized.
write stuff to a transaction after a new block is finalized .
&self
transaction
&mut DBTransaction
f_header
&Block::Header
f_hash
Block::Hash
displaced
&mut Option<FinalizationDisplaced<Block::Hash, NumberFor<Block>>>
&self
transaction
&mut DBTransaction
f_header
&Block::Header
f_hash
Block::Hash
displaced
&mut Option<FinalizationDisplaced<Block::Hash, NumberFor<Block>>>