pub fn reconcile_blockstore_roots_with_tower(
    tower: &Tower,
    blockstore: &Blockstore,
) -> blockstore_db::Result<()> {
    if let Some(tower_root) = tower.root() {
        let last_blockstore_root = blockstore.last_root();
        if last_blockstore_root < tower_root {
            // Ensure tower_root itself to exist and be marked as rooted in the blockstore
            // in addition to its ancestors.
            let new_roots: Vec<_> = AncestorIterator::new_inclusive(tower_root, &blockstore)
                .take_while(|current| match current.cmp(&last_blockstore_root) {
                    Ordering::Greater => true,
                    Ordering::Equal => false,
                    Ordering::Less => panic!(
                        "couldn't find a last_blockstore_root upwards from: {}!?",
                        tower_root
                    ),
                })
                .collect();
            assert!(
                !new_roots.is_empty(),
                "at least 1 parent slot must be found"
            );

            blockstore.set_roots(&new_roots)?
        }
    }
    Ok(())
}
// Given an untimely crash, tower may have roots that are not reflected in blockstore because
// `ReplayState::handle_votable_bank()` saves tower before setting blockstore roots
Given an untimely crash, tower may have roots that are not reflected in blockstore because
`ReplayState::handle_votable_bank()` saves tower before setting blockstore roots
Given an untimely crash tower may have roots that are not reflected in blockstore because ` ReplayState :: handle_votable_bank () ` saves tower before setting blockstore roots
pub fn reconcile_blockstore_roots_with_tower(
    tower: &Tower,
    blockstore: &Blockstore,
) -> blockstore_db::Result<()> {
    if let Some(tower_root) = tower.root() {
        let last_blockstore_root = blockstore.last_root();
        if last_blockstore_root < tower_root {
            // Ensure tower_root itself to exist and be marked as rooted in the blockstore
            // in addition to its ancestors.
            let new_roots: Vec<_> = AncestorIterator::new_inclusive(tower_root, &blockstore)
                .take_while(|current| match current.cmp(&last_blockstore_root) {
                    Ordering::Greater => true,
                    Ordering::Equal => false,
                    Ordering::Less => panic!(
                        "couldn't find a last_blockstore_root upwards from: {}!?",
                        tower_root
                    ),
                })
                .collect();
            assert!(
                !new_roots.is_empty(),
                "at least 1 parent slot must be found"
            );
            blockstore.set_roots(&new_roots)?
        }
    }
    Ok(())
}
pub fn reconcile_blockstore_roots_with_tower ( tower : & Tower , blockstore : & Blockstore , ) -> blockstore_db :: Result < ( ) > { if let Some ( tower_root ) = tower . root ( ) { let last_blockstore_root = blockstore . last_root ( ) ; if last_blockstore_root < tower_root { // Ensure tower_root itself to exist and be marked as rooted in the blockstore // in addition to its ancestors. let new_roots : Vec < _ > = AncestorIterator :: new_inclusive ( tower_root , & blockstore ) . take_while ( | current | match current . cmp ( & last_blockstore_root ) { Ordering :: Greater => true , Ordering :: Equal => false , Ordering :: Less => panic ! ( " " tower_root ) , } ) . collect ( ) ; assert ! ( new_roots is_empty ( ) " " ) ; blockstore . set_roots ( & new_roots ) ? } } Ok ( ( ) ) }
Given an untimely crash, tower may have roots that are not reflected in blockstore because
`ReplayState::handle_votable_bank()` saves tower before setting blockstore roots
Given an untimely crash tower may have roots that are not reflected in blockstore because ` ReplayState :: handle_votable_bank () ` saves tower before setting blockstore roots
tower
&Tower
blockstore
&Blockstore
tower
&Tower
blockstore
&Blockstore