pub fn commit_block(&mut self, prepared: PreparedBlock) {
        let parent_hash = prepared.block.header.previous_block_hash;
        let (height, hash) = (prepared.height, prepared.hash);

        let canopy_activation_height = Canopy.activation_height(self.network).unwrap();
        if height < canopy_activation_height {
            panic!(
                "invalid non-finalized block height: the canopy checkpoint is mandatory, pre-canopy blocks must be committed to the state as finalized blocks"
            );
        }

        let mut parent_chain = self
            .take_chain_if(|chain| chain.non_finalized_tip_hash() == parent_hash)
            .or_else(|| {
                self.chain_set
                    .iter()
                    .find_map(|chain| chain.fork(parent_hash))
                    .map(Box::new)
            })
            .expect("commit_block is only called with blocks that are ready to be commited");

        parent_chain.push(prepared);
        self.chain_set.insert(parent_chain);
        self.update_metrics_for_committed_block(height, hash);
    }
/// Commit block to the non-finalized state.
Commit block to the non-finalized state.
Commit block to the non - finalized state .
pub fn commit_block(&mut self, prepared: PreparedBlock) {
        let parent_hash = prepared.block.header.previous_block_hash;
        let (height, hash) = (prepared.height, prepared.hash);
        let canopy_activation_height = Canopy.activation_height(self.network).unwrap();
        if height < canopy_activation_height {
            panic!(
                "invalid non-finalized block height: the canopy checkpoint is mandatory, pre-canopy blocks must be committed to the state as finalized blocks"
            );
        }
        let mut parent_chain = self
            .take_chain_if(|chain| chain.non_finalized_tip_hash() == parent_hash)
            .or_else(|| {
                self.chain_set
                    .iter()
                    .find_map(|chain| chain.fork(parent_hash))
                    .map(Box::new)
            })
            .expect("commit_block is only called with blocks that are ready to be commited");
        parent_chain.push(prepared);
        self.chain_set.insert(parent_chain);
        self.update_metrics_for_committed_block(height, hash);
    }
pub fn commit_block ( & mut self , prepared : PreparedBlock ) { let parent_hash = prepared . block . header . previous_block_hash ; let ( height , hash ) = ( prepared . height , prepared . hash ) ; let canopy_activation_height = Canopy . activation_height ( self . network ) . unwrap ( ) ; if height < canopy_activation_height { panic ! ( " " ) ; } let mut parent_chain = self . take_chain_if ( | chain | chain . non_finalized_tip_hash ( ) == parent_hash ) . or_else ( | | { self . chain_set . iter ( ) . find_map ( | chain | chain . fork ( parent_hash ) ) . map ( Box :: new ) } ) . expect ( " " ) ; parent_chain . push ( prepared ) ; self . chain_set . insert ( parent_chain ) ; self . update_metrics_for_committed_block ( height , hash ) ; }
Commit block to the non-finalized state.
Commit block to the non - finalized state .
&mut self
prepared
PreparedBlock