pub fn on_block_finalize<Tx: StorageTransaction<Block, T>>(
		&self,
		tx: &mut Tx,
		parent: ComplexBlockId<Block>,
		block: ComplexBlockId<Block>,
	) -> ClientResult<Option<CommitOperation<Block, T>>> {
		// this guarantee is currently provided by LightStorage && we're relying on it here
		debug_assert_eq!(self.best_finalized_block.hash, parent.hash);

		// there could be at most one entry that is finalizing
		let finalizing_entry = self.storage.read_entry(&block)?
			.map(|entry| entry.into_entry(block.clone()));

		// cleanup database from abandoned unfinalized forks and obsolete finalized entries
		let abandoned_forks = self.destroy_abandoned_forks(tx, &block);
		self.prune_finalized_entries(tx, &block);

		let update_meta = finalizing_entry.is_some();
		let operation = CommitOperation::BlockFinalized(block, finalizing_entry, abandoned_forks);
		if update_meta {
			tx.update_meta(self.best_finalized_entry.as_ref(), &self.unfinalized, &operation);
		}
		Ok(Some(operation))
	}
/// When previously inserted block is finalized.
When previously inserted block is finalized.
When previously inserted block is finalized .
pub fn on_block_finalize<Tx: StorageTransaction<Block, T>>(
		&self,
		tx: &mut Tx,
		parent: ComplexBlockId<Block>,
		block: ComplexBlockId<Block>,
	) -> ClientResult<Option<CommitOperation<Block, T>>> {
		// this guarantee is currently provided by LightStorage && we're relying on it here
		debug_assert_eq!(self.best_finalized_block.hash, parent.hash);
		// there could be at most one entry that is finalizing
		let finalizing_entry = self.storage.read_entry(&block)?
			.map(|entry| entry.into_entry(block.clone()));
		// cleanup database from abandoned unfinalized forks and obsolete finalized entries
		let abandoned_forks = self.destroy_abandoned_forks(tx, &block);
		self.prune_finalized_entries(tx, &block);
		let update_meta = finalizing_entry.is_some();
		let operation = CommitOperation::BlockFinalized(block, finalizing_entry, abandoned_forks);
		if update_meta {
			tx.update_meta(self.best_finalized_entry.as_ref(), &self.unfinalized, &operation);
		}
		Ok(Some(operation))
	}
pub fn on_block_finalize < Tx : StorageTransaction < Block , T > > ( & self , tx : & mut Tx , parent : ComplexBlockId < Block > , block : ComplexBlockId < Block > , ) -> ClientResult < Option < CommitOperation < Block , T > > > { // this guarantee is currently provided by LightStorage && we're relying on it here debug_assert_eq ! ( self best_finalized_block hash parent hash ) ; // there could be at most one entry that is finalizing let finalizing_entry = self . storage . read_entry ( & block ) ? . map ( | entry | entry . into_entry ( block . clone ( ) ) ) ; // cleanup database from abandoned unfinalized forks and obsolete finalized entries let abandoned_forks = self . destroy_abandoned_forks ( tx , & block ) ; self . prune_finalized_entries ( tx , & block ) ; let update_meta = finalizing_entry . is_some ( ) ; let operation = CommitOperation :: BlockFinalized ( block , finalizing_entry , abandoned_forks ) ; if update_meta { tx . update_meta ( self . best_finalized_entry . as_ref ( ) , & self . unfinalized , & operation ) ; } Ok ( Some ( operation ) ) }
When previously inserted block is finalized.
When previously inserted block is finalized .
&self
tx
&mut Tx
parent
ComplexBlockId<Block>
block
ComplexBlockId<Block>
&self
tx
&mut Tx
parent
ComplexBlockId<Block>
block
ComplexBlockId<Block>