fn fork(&self, tip: &BlockHash) -> Option<Candidate> {
        let tip = *tip;

        let mut headers = VecDeque::new();
        let mut cursor = tip;

        assert!(
            !self.headers.contains_key(&tip),
            "BlockCache::fork: the provided tip must not be on the active chain"
        );

        while let Some(header) = self.orphans.get(&cursor) {
            cursor = header.prev_blockhash;
            headers.push_front(*header);
        }

        if let Some(height) = self.headers.get(&cursor) {
            return Some(Candidate {
                tip,
                fork_height: *height,
                fork_hash: cursor,
                headers: headers.into(),
            });
        }
        None
    }
/// Find a potential branch starting from the active chain and ending at the given tip.
/// The tip must be not be an active block. Returns `None` if no branch was found.
///
/// # Errors
///
/// Panics if the provided tip is on the active chain.
///
Find a potential branch starting from the active chain and ending at the given tip.
The tip must be not be an active block. Returns `None` if no branch was found.
Find a potential branch starting from the active chain and ending at the given tip . The tip must be not be an active block . Returns ` None ` if no branch was found .
fn fork(&self, tip: &BlockHash) -> Option<Candidate> {
        let tip = *tip;
        let mut headers = VecDeque::new();
        let mut cursor = tip;
        assert!(
            !self.headers.contains_key(&tip),
            "BlockCache::fork: the provided tip must not be on the active chain"
        );
        while let Some(header) = self.orphans.get(&cursor) {
            cursor = header.prev_blockhash;
            headers.push_front(*header);
        }
        if let Some(height) = self.headers.get(&cursor) {
            return Some(Candidate {
                tip,
                fork_height: *height,
                fork_hash: cursor,
                headers: headers.into(),
            });
        }
        None
    }
fn fork ( & self , tip : & BlockHash ) -> Option < Candidate > { let tip = * tip ; let mut headers = VecDeque :: new ( ) ; let mut cursor = tip ; assert ! ( self headers contains_key ( tip ) " " ) ; while let Some ( header ) = self . orphans . get ( & cursor ) { cursor = header . prev_blockhash ; headers . push_front ( * header ) ; } if let Some ( height ) = self . headers . get ( & cursor ) { return Some ( Candidate { tip , fork_height : * height , fork_hash : cursor , headers : headers . into ( ) , } ) ; } None }
Find a potential branch starting from the active chain and ending at the given tip.
Find a potential branch starting from the active chain and ending at the given tip .
&self
tip
&BlockHash
errors
Panics if the provided tip is on the active chain.
Panics if the provided tip is on the active chain .