fn switch_to_fork(&mut self, branch: &Candidate) -> Result<Vec<BlockHeader>, Error> {
        let stale = self.rollback(branch.fork_height)?;

        for (i, header) in branch.headers.iter().enumerate() {
            self.extend_chain(
                branch.fork_height + i as Height + 1,
                header.block_hash(),
                *header,
            );
        }
        self.store.put(branch.headers.iter().cloned())?;

        Ok(stale)
    }
/// Activate a fork candidate. Returns the list of rolled-back (stale) headers.
Activate a fork candidate. Returns the list of rolled-back (stale) headers.
Activate a fork candidate . Returns the list of rolled - back ( stale ) headers .
fn switch_to_fork(&mut self, branch: &Candidate) -> Result<Vec<BlockHeader>, Error> {
        let stale = self.rollback(branch.fork_height)?;
        for (i, header) in branch.headers.iter().enumerate() {
            self.extend_chain(
                branch.fork_height + i as Height + 1,
                header.block_hash(),
                *header,
            );
        }
        self.store.put(branch.headers.iter().cloned())?;
        Ok(stale)
    }
fn switch_to_fork ( & mut self , branch : & Candidate ) -> Result < Vec < BlockHeader > , Error > { let stale = self . rollback ( branch . fork_height ) ? ; for ( i , header ) in branch . headers . iter ( ) . enumerate ( ) { self . extend_chain ( branch . fork_height + i as Height + 1 , header . block_hash ( ) , * header , ) ; } self . store . put ( branch . headers . iter ( ) . cloned ( ) ) ? ; Ok ( stale ) }
Activate a fork candidate.
Activate a fork candidate .
&mut self
branch
&Candidate