// The tower root can be older/newer if the validator booted from a newer/older snapshot, so
// tower lockouts may need adjustment
The tower root can be older/newer if the validator booted from a newer/older snapshot, so
tower lockouts may need adjustment
The tower root can be older / newer if the validator booted from a newer / older snapshot so tower lockouts may need adjustment
pub fn adjust_lockouts_after_replay(
        self,
        replayed_root: Slot,
        slot_history: &SlotHistory,
    ) -> Result<Self> {
        info!(
            "adjusting lockouts (after replay up to {}): {:?}",
            replayed_root,
            self.voted_slots()
        );
        // sanity assertions for roots
        assert_eq!(slot_history.check(replayed_root), Check::Found);
        assert!(self.root().is_some());
        let tower_root = self.root().unwrap();
        // reconcile_blockstore_roots_with_tower() should already have aligned these.
        assert!(
            tower_root <= replayed_root,
            format!(
                "tower root: {:?} >= replayed root slot: {}",
                tower_root, replayed_root
            )
        );
        assert!(
            self.last_vote == Vote::default() && self.lockouts.votes.is_empty()
                || self.last_vote != Vote::default() && !self.lockouts.votes.is_empty(),
            format!(
                "last vote: {:?} lockouts.votes: {:?}",
                self.last_vote, self.lockouts.votes
            )
        );
        // return immediately if votes are empty...
        if self.lockouts.votes.is_empty() {
            return Ok(self);
        }
        let last_voted_slot = self.last_voted_slot().unwrap();
        if slot_history.check(last_voted_slot) == Check::TooOld {
            // We could try hard to anchor with other older votes, but opt to simplify the
            // following logic
            return Err(TowerError::TooOldTower(
                last_voted_slot,
                slot_history.oldest(),
            ));
        }
        self.do_adjust_lockouts_after_replay(tower_root, replayed_root, slot_history)
    }
pub fn adjust_lockouts_after_replay ( self , replayed_root : Slot , slot_history : & SlotHistory , ) -> Result < Self > { info ! ( " " replayed_root self voted_slots ( ) ) ; // sanity assertions for roots assert_eq ! ( slot_history check ( replayed_root ) Check Found ) ; assert ! ( self root ( ) is_some ( ) ) ; let tower_root = self . root ( ) . unwrap ( ) ; // reconcile_blockstore_roots_with_tower() should already have aligned these. assert ! ( tower_root replayed_root format ( " " tower_root replayed_root ) ) ; assert ! ( self last_vote Vote default ( ) self lockouts votes is_empty ( ) self last_vote Vote default ( ) self lockouts votes is_empty ( ) format ( " " self last_vote self lockouts votes ) ) ; // return immediately if votes are empty... if self . lockouts . votes . is_empty ( ) { return Ok ( self ) ; } let last_voted_slot = self . last_voted_slot ( ) . unwrap ( ) ; if slot_history . check ( last_voted_slot ) == Check :: TooOld { // We could try hard to anchor with other older votes, but opt to simplify the // following logic return Err ( TowerError :: TooOldTower ( last_voted_slot , slot_history . oldest ( ) , ) ) ; } self . do_adjust_lockouts_after_replay ( tower_root , replayed_root , slot_history ) }
The tower root can be older/newer if the validator booted from a newer/older snapshot, so
tower lockouts may need adjustment
The tower root can be older / newer if the validator booted from a newer / older snapshot so tower lockouts may need adjustment
self
replayed_root
Slot
slot_history
&SlotHistory