fn force_delayed_canonicalize(
		&self,
		transaction: &mut DBTransaction,
		hash: Block::Hash,
		number: NumberFor<Block>,
	)
		-> Result<(), client::error::Error>
	{
		let number_u64 = number.as_();
		if number_u64 > self.canonicalization_delay {
			let new_canonical = number_u64 - self.canonicalization_delay;

			if new_canonical <= self.storage.state_db.best_canonical().unwrap_or(0) {
				return Ok(())
			}

			let hash = if new_canonical == number_u64 {
				hash
			} else {
				::client::blockchain::HeaderBackend::hash(&self.blockchain, As::sa(new_canonical))?
					.expect("existence of block with number `new_canonical` \
						implies existence of blocks with all numbers before it; qed")
			};

			trace!(target: "db", "Canonicalize block #{} ({:?})", new_canonical, hash);
			let commit = self.storage.state_db.canonicalize_block(&hash)
				.map_err(|e: state_db::Error<io::Error>| client::error::Error::from(format!("State database error: {:?}", e)))?;
			apply_state_commit(transaction, commit);
		};

		Ok(())
	}
// performs forced canonicaliziation with a delay after importning a non-finalized block.
performs forced canonicaliziation with a delay after importning a non-finalized block.
performs forced canonicaliziation with a delay after importning a non - finalized block .
fn force_delayed_canonicalize(
		&self,
		transaction: &mut DBTransaction,
		hash: Block::Hash,
		number: NumberFor<Block>,
	)
		-> Result<(), client::error::Error>
	{
		let number_u64 = number.as_();
		if number_u64 > self.canonicalization_delay {
			let new_canonical = number_u64 - self.canonicalization_delay;
			if new_canonical <= self.storage.state_db.best_canonical().unwrap_or(0) {
				return Ok(())
			}
			let hash = if new_canonical == number_u64 {
				hash
			} else {
				::client::blockchain::HeaderBackend::hash(&self.blockchain, As::sa(new_canonical))?
					.expect("existence of block with number `new_canonical` \
						implies existence of blocks with all numbers before it; qed")
			};
			trace!(target: "db", "Canonicalize block #{} ({:?})", new_canonical, hash);
			let commit = self.storage.state_db.canonicalize_block(&hash)
				.map_err(|e: state_db::Error<io::Error>| client::error::Error::from(format!("State database error: {:?}", e)))?;
			apply_state_commit(transaction, commit);
		};
		Ok(())
	}
fn force_delayed_canonicalize ( & self , transaction : & mut DBTransaction , hash : Block :: Hash , number : NumberFor < Block > , ) -> Result < ( ) , client :: error :: Error > { let number_u64 = number . as_ ( ) ; if number_u64 > self . canonicalization_delay { let new_canonical = number_u64 - self . canonicalization_delay ; if new_canonical <= self . storage . state_db . best_canonical ( ) . unwrap_or ( 0 ) { return Ok ( ( ) ) } let hash = if new_canonical == number_u64 { hash } else { :: client :: blockchain :: HeaderBackend :: hash ( & self . blockchain , As :: sa ( new_canonical ) ) ? . expect ( " \
 " ) } ; trace ! ( target " " " " new_canonical hash ) ; let commit = self . storage . state_db . canonicalize_block ( & hash ) . map_err ( | e : state_db :: Error < io :: Error > | client :: error :: Error :: from ( format ! ( " " e ) ) ) ? ; apply_state_commit ( transaction , commit ) ; } ; Ok ( ( ) ) }
performs forced canonicaliziation with a delay after importning a non-finalized block.
performs forced canonicaliziation with a delay after importning a non - finalized block .
&self
transaction
&mut DBTransaction
hash
Block::Hash
number
NumberFor<Block>
&self
transaction
&mut DBTransaction
hash
Block::Hash
number
NumberFor<Block>