pub fn insert_single_quorum_cert(&self, qc: QuorumCert) -> anyhow::Result<()> {
        // If the parent block is not the root block (i.e not None), ensure the executed state
        // of a block is consistent with its QuorumCert, otherwise persist the QuorumCert's
        // state and on restart, a new execution will agree with it.  A new execution will match
        // the QuorumCert's state on the next restart will work if there is a memory
        // corruption, for example.
        match self.get_block(qc.certified_block().id()) {
            Some(executed_block) => {
                ensure!(
                    executed_block.block_info() == *qc.certified_block(),
                    "QC for block {} has different {:?} than local {:?}",
                    qc.certified_block().id(),
                    qc.certified_block(),
                    executed_block.block_info()
                );
            }
            None => bail!("Insert {} without having the block in store first", qc),
        }

        self.storage
            .save_tree(vec![], vec![qc.clone()])
            .context("Insert block failed when saving quorum")?;
        self.inner.write().unwrap().insert_quorum_cert(qc)
    }
/// Validates quorum certificates and inserts it into block tree assuming dependencies exist.
Validates quorum certificates and inserts it into block tree assuming dependencies exist.
Validates quorum certificates and inserts it into block tree assuming dependencies exist .
pub fn insert_single_quorum_cert(&self, qc: QuorumCert) -> anyhow::Result<()> {
        // If the parent block is not the root block (i.e not None), ensure the executed state
        // of a block is consistent with its QuorumCert, otherwise persist the QuorumCert's
        // state and on restart, a new execution will agree with it.  A new execution will match
        // the QuorumCert's state on the next restart will work if there is a memory
        // corruption, for example.
        match self.get_block(qc.certified_block().id()) {
            Some(executed_block) => {
                ensure!(
                    executed_block.block_info() == *qc.certified_block(),
                    "QC for block {} has different {:?} than local {:?}",
                    qc.certified_block().id(),
                    qc.certified_block(),
                    executed_block.block_info()
                );
            }
            None => bail!("Insert {} without having the block in store first", qc),
        }
        self.storage
            .save_tree(vec![], vec![qc.clone()])
            .context("Insert block failed when saving quorum")?;
        self.inner.write().unwrap().insert_quorum_cert(qc)
    }
pub fn insert_single_quorum_cert ( & self , qc : QuorumCert ) -> anyhow :: Result < ( ) > { // If the parent block is not the root block (i.e not None), ensure the executed state // of a block is consistent with its QuorumCert, otherwise persist the QuorumCert's // state and on restart, a new execution will agree with it.  A new execution will match // the QuorumCert's state on the next restart will work if there is a memory // corruption, for example. match self . get_block ( qc . certified_block ( ) . id ( ) ) { Some ( executed_block ) => { ensure ! ( executed_block block_info ( ) qc certified_block ( ) " " qc certified_block ( ) id ( ) qc certified_block ( ) executed_block block_info ( ) ) ; } None => bail ! ( " " qc ) , } self . storage . save_tree ( vec ! [ ] , vec ! [ qc clone ( ) ] ) . context ( " " ) ? ; self . inner . write ( ) . unwrap ( ) . insert_quorum_cert ( qc ) }
Validates quorum certificates and inserts it into block tree assuming dependencies exist.
Validates quorum certificates and inserts it into block tree assuming dependencies exist .
&self
qc
QuorumCert
&self
qc
QuorumCert