pub fn fetch_last_mmr_node_added_count<T>(checkpoints: &T) -> Result<u32, ChainStorageError>
where
    T: ArrayLike<Value = MerkleCheckPoint>,
    ChainStorageError: From<T::Error>,
{
    let cp_count = checkpoints.len()?;
    match cp_count.checked_sub(1) {
        Some(last_index) => Ok(checkpoints
            .get(last_index)?
            .map(|cp| cp.accumulated_nodes_added_count())
            .unwrap_or(0)),
        None => Ok(0),
    }
}
/// Returns the accumulated node added count.
Returns the accumulated node added count.
Returns the accumulated node added count .
pub fn fetch_last_mmr_node_added_count<T>(checkpoints: &T) -> Result<u32, ChainStorageError>
where
    T: ArrayLike<Value = MerkleCheckPoint>,
    ChainStorageError: From<T::Error>,
{
    let cp_count = checkpoints.len()?;
    match cp_count.checked_sub(1) {
        Some(last_index) => Ok(checkpoints
            .get(last_index)?
            .map(|cp| cp.accumulated_nodes_added_count())
            .unwrap_or(0)),
        None => Ok(0),
    }
}
pub fn fetch_last_mmr_node_added_count < T > ( checkpoints : & T ) -> Result < u32 , ChainStorageError > where T : ArrayLike < Value = MerkleCheckPoint > , ChainStorageError : From < T :: Error > , { let cp_count = checkpoints . len ( ) ? ; match cp_count . checked_sub ( 1 ) { Some ( last_index ) => Ok ( checkpoints . get ( last_index ) ? . map ( | cp | cp . accumulated_nodes_added_count ( ) ) . unwrap_or ( 0 ) ) , None => Ok ( 0 ) , } }
Returns the accumulated node added count.
Returns the accumulated node added count .
checkpoints
&T
checkpoints
&T