pub(super) fn path_from_root(&self, block: Arc<Block<T>>) -> Option<Vec<Arc<Block<T>>>> {
        let mut res = vec![];
        let mut cur_block = block;
        while cur_block.round() > self.root.round() {
            res.push(Arc::clone(&cur_block));
            cur_block = match self.get_block(cur_block.parent_id()) {
                None => {
                    return None;
                }
                Some(b) => b,
            };
        }
        // At this point cur_block.round() <= self.root.round()
        if cur_block.id() != self.root.id() {
            return None;
        }
        Some(res)
    }
/// Returns all the blocks between the root and the given block, including the given block
/// but excluding the root.
/// In case a given block is not the successor of the root, return None.
/// While generally the provided blocks should always belong to the active tree, there might be
/// a race, in which the root of the tree is propagated forward between retrieving the block
/// and getting its path from root (e.g., at proposal generator). Hence, we don't want to panic
/// and prefer to return None instead.
Returns all the blocks between the root and the given block, including the given block
but excluding the root.
In case a given block is not the successor of the root, return None.
While generally the provided blocks should always belong to the active tree, there might be
a race, in which the root of the tree is propagated forward between retrieving the block
and getting its path from root . Hence, we don't want to panic
and prefer to return None instead.
Returns all the blocks between the root and the given block including the given block but excluding the root . In case a given block is not the successor of the root return None . While generally the provided blocks should always belong to the active tree there might be a race in which the root of the tree is propagated forward between retrieving the block and getting its path from root . Hence we don ' t want to panic and prefer to return None instead .
pub(super) fn path_from_root(&self, block: Arc<Block<T>>) -> Option<Vec<Arc<Block<T>>>> {
        let mut res = vec![];
        let mut cur_block = block;
        while cur_block.round() > self.root.round() {
            res.push(Arc::clone(&cur_block));
            cur_block = match self.get_block(cur_block.parent_id()) {
                None => {
                    return None;
                }
                Some(b) => b,
            };
        }
        // At this point cur_block.round() <= self.root.round()
        if cur_block.id() != self.root.id() {
            return None;
        }
        Some(res)
    }
pub ( super ) fn path_from_root ( & self , block : Arc < Block < T > > ) -> Option < Vec < Arc < Block < T > > > > { let mut res = vec ! [ ] ; let mut cur_block = block ; while cur_block . round ( ) > self . root . round ( ) { res . push ( Arc :: clone ( & cur_block ) ) ; cur_block = match self . get_block ( cur_block . parent_id ( ) ) { None => { return None ; } Some ( b ) => b , } ; } // At this point cur_block.round() <= self.root.round() if cur_block . id ( ) != self . root . id ( ) { return None ; } Some ( res ) }
Returns all the blocks between the root and the given block, including the given block
but excluding the root.
Returns all the blocks between the root and the given block including the given block but excluding the root .
&self
block
Arc<Block<T>>
&self
block
Arc<Block<T>>