pub fn insert(
		&self,
		hash: Block::Hash,
		header: <Block as BlockT>::Header,
		justification: Option<Justification>,
		body: Option<Vec<<Block as BlockT>::Extrinsic>>,
		new_state: NewBlockState,
	) -> crate::error::Result<()> {
		let number = header.number().clone();
		if new_state.is_best() {
			self.apply_head(&header)?;
		}

		{
			let mut storage = self.storage.write();
			storage.leaves.import(hash.clone(), number.clone(), header.parent_hash().clone());
			storage.blocks.insert(hash.clone(), StoredBlock::new(header, body, justification));

			if let NewBlockState::Final = new_state {
				storage.finalized_hash = hash;
				storage.finalized_number = number.clone();
			}

			if number == Zero::zero() {
				storage.genesis_hash = hash;
			}
		}

		Ok(())
	}
/// Insert a block header and associated data.
Insert a block header and associated data.
Insert a block header and associated data .
pub fn insert(
		&self,
		hash: Block::Hash,
		header: <Block as BlockT>::Header,
		justification: Option<Justification>,
		body: Option<Vec<<Block as BlockT>::Extrinsic>>,
		new_state: NewBlockState,
	) -> crate::error::Result<()> {
		let number = header.number().clone();
		if new_state.is_best() {
			self.apply_head(&header)?;
		}
		{
			let mut storage = self.storage.write();
			storage.leaves.import(hash.clone(), number.clone(), header.parent_hash().clone());
			storage.blocks.insert(hash.clone(), StoredBlock::new(header, body, justification));
			if let NewBlockState::Final = new_state {
				storage.finalized_hash = hash;
				storage.finalized_number = number.clone();
			}
			if number == Zero::zero() {
				storage.genesis_hash = hash;
			}
		}
		Ok(())
	}
pub fn insert ( & self , hash : Block :: Hash , header : < Block as BlockT > :: Header , justification : Option < Justification > , body : Option < Vec < < Block as BlockT > :: Extrinsic > > , new_state : NewBlockState , ) -> crate :: error :: Result < ( ) > { let number = header . number ( ) . clone ( ) ; if new_state . is_best ( ) { self . apply_head ( & header ) ? ; } { let mut storage = self . storage . write ( ) ; storage . leaves . import ( hash . clone ( ) , number . clone ( ) , header . parent_hash ( ) . clone ( ) ) ; storage . blocks . insert ( hash . clone ( ) , StoredBlock :: new ( header , body , justification ) ) ; if let NewBlockState :: Final = new_state { storage . finalized_hash = hash ; storage . finalized_number = number . clone ( ) ; } if number == Zero :: zero ( ) { storage . genesis_hash = hash ; } } Ok ( ( ) ) }
Insert a block header and associated data.
Insert a block header and associated data .
&self
hash
Block::Hash
header
<Block as BlockT>::Header
justification
Option<Justification>
body
Option<Vec<<Block as BlockT>::Extrinsic>>
new_state
NewBlockState
&self
hash
Block::Hash
header
<Block as BlockT>::Header
justification
Option<Justification>
body
Option<Vec<<Block as BlockT>::Extrinsic>>
new_state
NewBlockState