Rename Tower::lockouts to Tower::vote_state
(cherry picked from commit d5c2c72360)
			
			
This commit is contained in:
		| @@ -104,13 +104,13 @@ pub(crate) struct ComputedBankState { | ||||
|     pub my_latest_landed_vote: Option<Slot>, | ||||
| } | ||||
|  | ||||
| #[frozen_abi(digest = "Eay84NBbJqiMBfE7HHH2o6e51wcvoU79g8zCi5sw6uj3")] | ||||
| #[frozen_abi(digest = "GMs1FxKteU7K4ZFRofMBqNhBpM4xkPVxfYod6R8DQmpT")] | ||||
| #[derive(Clone, Serialize, Deserialize, Debug, PartialEq, AbiExample)] | ||||
| pub struct Tower { | ||||
|     node_pubkey: Pubkey, | ||||
|     threshold_depth: usize, | ||||
|     threshold_size: f64, | ||||
|     lockouts: VoteState, | ||||
|     vote_state: VoteState, | ||||
|     last_vote: Vote, | ||||
|     #[serde(skip)] | ||||
|     // The blockhash used in the last vote transaction, may or may not equal the | ||||
| @@ -141,7 +141,7 @@ impl Default for Tower { | ||||
|             node_pubkey: Pubkey::default(), | ||||
|             threshold_depth: VOTE_THRESHOLD_DEPTH, | ||||
|             threshold_size: VOTE_THRESHOLD_SIZE, | ||||
|             lockouts: VoteState::default(), | ||||
|             vote_state: VoteState::default(), | ||||
|             last_vote: Vote::default(), | ||||
|             last_timestamp: BlockTimestamp::default(), | ||||
|             last_vote_tx_blockhash: Hash::default(), | ||||
| @@ -151,7 +151,7 @@ impl Default for Tower { | ||||
|             last_switch_threshold_check: Option::default(), | ||||
|         }; | ||||
|         // VoteState::root_slot is ensured to be Some in Tower | ||||
|         tower.lockouts.root_slot = Some(Slot::default()); | ||||
|         tower.vote_state.root_slot = Some(Slot::default()); | ||||
|         tower | ||||
|     } | ||||
| } | ||||
| @@ -373,7 +373,7 @@ impl Tower { | ||||
|     } | ||||
|  | ||||
|     pub fn tower_slots(&self) -> Vec<Slot> { | ||||
|         self.lockouts.tower() | ||||
|         self.vote_state.tower() | ||||
|     } | ||||
|  | ||||
|     pub fn last_vote_tx_blockhash(&self) -> Hash { | ||||
| @@ -421,7 +421,7 @@ impl Tower { | ||||
|         let last_voted_slot_in_bank = Self::last_voted_slot_in_bank(bank, vote_account_pubkey); | ||||
|  | ||||
|         // Returns the new root if one is made after applying a vote for the given bank to | ||||
|         // `self.lockouts` | ||||
|         // `self.vote_state` | ||||
|         self.record_bank_vote_and_update_lockouts(bank.slot(), bank.hash(), last_voted_slot_in_bank) | ||||
|     } | ||||
|  | ||||
| @@ -434,7 +434,7 @@ impl Tower { | ||||
|         trace!("{} record_vote for {}", self.node_pubkey, vote_slot); | ||||
|         let old_root = self.root(); | ||||
|         let mut new_vote = Self::apply_vote_and_generate_vote_diff( | ||||
|             &mut self.lockouts, | ||||
|             &mut self.vote_state, | ||||
|             vote_slot, | ||||
|             vote_hash, | ||||
|             last_voted_slot_in_bank, | ||||
| @@ -502,12 +502,12 @@ impl Tower { | ||||
|     // snapshot (slot N). In other words, there should be no possibility a Tower doesn't have | ||||
|     // root, unlike young vote accounts. | ||||
|     pub fn root(&self) -> Slot { | ||||
|         self.lockouts.root_slot.unwrap() | ||||
|         self.vote_state.root_slot.unwrap() | ||||
|     } | ||||
|  | ||||
|     // a slot is recent if it's newer than the last vote we have | ||||
|     pub fn is_recent(&self, slot: Slot) -> bool { | ||||
|         if let Some(last_voted_slot) = self.lockouts.last_voted_slot() { | ||||
|         if let Some(last_voted_slot) = self.vote_state.last_voted_slot() { | ||||
|             if slot <= last_voted_slot { | ||||
|                 return false; | ||||
|             } | ||||
| @@ -516,7 +516,7 @@ impl Tower { | ||||
|     } | ||||
|  | ||||
|     pub fn has_voted(&self, slot: Slot) -> bool { | ||||
|         for vote in &self.lockouts.votes { | ||||
|         for vote in &self.vote_state.votes { | ||||
|             if slot == vote.slot { | ||||
|                 return true; | ||||
|             } | ||||
| @@ -533,15 +533,15 @@ impl Tower { | ||||
|         // slot to the current lockouts to pop any expired votes. If any of the | ||||
|         // remaining voted slots are on a different fork from the checked slot, | ||||
|         // it's still locked out. | ||||
|         let mut lockouts = self.lockouts.clone(); | ||||
|         lockouts.process_slot_vote_unchecked(slot); | ||||
|         for vote in &lockouts.votes { | ||||
|         let mut vote_state = self.vote_state.clone(); | ||||
|         vote_state.process_slot_vote_unchecked(slot); | ||||
|         for vote in &vote_state.votes { | ||||
|             if slot != vote.slot && !ancestors.contains(&vote.slot) { | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if let Some(root_slot) = lockouts.root_slot { | ||||
|         if let Some(root_slot) = vote_state.root_slot { | ||||
|             if slot != root_slot { | ||||
|                 // This case should never happen because bank forks purges all | ||||
|                 // non-descendants of the root every time root is set | ||||
| @@ -862,9 +862,9 @@ impl Tower { | ||||
|         voted_stakes: &VotedStakes, | ||||
|         total_stake: Stake, | ||||
|     ) -> bool { | ||||
|         let mut lockouts = self.lockouts.clone(); | ||||
|         lockouts.process_slot_vote_unchecked(slot); | ||||
|         let vote = lockouts.nth_recent_vote(self.threshold_depth); | ||||
|         let mut vote_state = self.vote_state.clone(); | ||||
|         vote_state.process_slot_vote_unchecked(slot); | ||||
|         let vote = vote_state.nth_recent_vote(self.threshold_depth); | ||||
|         if let Some(vote) = vote { | ||||
|             if let Some(fork_stake) = voted_stakes.get(&vote.slot) { | ||||
|                 let lockout = *fork_stake as f64 / total_stake as f64; | ||||
| @@ -873,7 +873,7 @@ impl Tower { | ||||
|                     slot, vote.slot, lockout, fork_stake, total_stake | ||||
|                 ); | ||||
|                 if vote.confirmation_count as usize > self.threshold_depth { | ||||
|                     for old_vote in &self.lockouts.votes { | ||||
|                     for old_vote in &self.vote_state.votes { | ||||
|                         if old_vote.slot == vote.slot | ||||
|                             && old_vote.confirmation_count == vote.confirmation_count | ||||
|                         { | ||||
| @@ -928,7 +928,7 @@ impl Tower { | ||||
|     } | ||||
|  | ||||
|     fn voted_slots(&self) -> Vec<Slot> { | ||||
|         self.lockouts | ||||
|         self.vote_state | ||||
|             .votes | ||||
|             .iter() | ||||
|             .map(|lockout| lockout.slot) | ||||
| @@ -964,11 +964,11 @@ impl Tower { | ||||
|         assert_eq!(slot_history.check(replayed_root), Check::Found); | ||||
|  | ||||
|         assert!( | ||||
|             self.last_vote == Vote::default() && self.lockouts.votes.is_empty() | ||||
|                 || self.last_vote != Vote::default() && !self.lockouts.votes.is_empty(), | ||||
|             "last vote: {:?} lockouts.votes: {:?}", | ||||
|             self.last_vote == Vote::default() && self.vote_state.votes.is_empty() | ||||
|                 || self.last_vote != Vote::default() && !self.vote_state.votes.is_empty(), | ||||
|             "last vote: {:?} vote_state.votes: {:?}", | ||||
|             self.last_vote, | ||||
|             self.lockouts.votes | ||||
|             self.vote_state.votes | ||||
|         ); | ||||
|  | ||||
|         if let Some(last_voted_slot) = self.last_voted_slot() { | ||||
| @@ -1034,7 +1034,7 @@ impl Tower { | ||||
|         let tower_root = self.root(); | ||||
|         // retained slots will be consisted only from divergent slots | ||||
|         let mut retain_flags_for_each_vote_in_reverse: Vec<_> = | ||||
|             Vec::with_capacity(self.lockouts.votes.len()); | ||||
|             Vec::with_capacity(self.vote_state.votes.len()); | ||||
|  | ||||
|         let mut still_in_future = true; | ||||
|         let mut past_outside_history = false; | ||||
| @@ -1112,10 +1112,10 @@ impl Tower { | ||||
|         let mut retain_flags_for_each_vote = | ||||
|             retain_flags_for_each_vote_in_reverse.into_iter().rev(); | ||||
|  | ||||
|         let original_votes_len = self.lockouts.votes.len(); | ||||
|         let original_votes_len = self.vote_state.votes.len(); | ||||
|         self.initialize_lockouts(move |_| retain_flags_for_each_vote.next().unwrap()); | ||||
|  | ||||
|         if self.lockouts.votes.is_empty() { | ||||
|         if self.vote_state.votes.is_empty() { | ||||
|             info!("All restored votes were behind; resetting root_slot and last_vote in tower!"); | ||||
|             // we might not have banks for those votes so just reset. | ||||
|             // That's because the votes may well past replayed_root | ||||
| @@ -1145,7 +1145,7 @@ impl Tower { | ||||
|         bank: &Bank, | ||||
|     ) { | ||||
|         if let Some((_stake, vote_account)) = bank.get_vote_account(vote_account_pubkey) { | ||||
|             self.lockouts = vote_account | ||||
|             self.vote_state = vote_account | ||||
|                 .vote_state() | ||||
|                 .as_ref() | ||||
|                 .expect("vote_account isn't a VoteState?") | ||||
| @@ -1158,7 +1158,7 @@ impl Tower { | ||||
|                 bank.slot(), | ||||
|             ); | ||||
|             assert_eq!( | ||||
|                 self.lockouts.node_pubkey, self.node_pubkey, | ||||
|                 self.vote_state.node_pubkey, self.node_pubkey, | ||||
|                 "vote account's node_pubkey doesn't match", | ||||
|             ); | ||||
|         } else { | ||||
| @@ -1172,13 +1172,13 @@ impl Tower { | ||||
|     } | ||||
|  | ||||
|     fn initialize_lockouts<F: FnMut(&Lockout) -> bool>(&mut self, should_retain: F) { | ||||
|         self.lockouts.votes.retain(should_retain); | ||||
|         self.vote_state.votes.retain(should_retain); | ||||
|     } | ||||
|  | ||||
|     // Updating root is needed to correctly restore from newly-saved tower for the next | ||||
|     // boot | ||||
|     fn initialize_root(&mut self, root: Slot) { | ||||
|         self.lockouts.root_slot = Some(root); | ||||
|         self.vote_state.root_slot = Some(root); | ||||
|     } | ||||
|  | ||||
|     pub fn get_filename(path: &Path, node_pubkey: &Pubkey) -> PathBuf { | ||||
| @@ -1800,8 +1800,8 @@ pub mod test { | ||||
|         } | ||||
|  | ||||
|         for i in 0..5 { | ||||
|             assert_eq!(tower.lockouts.votes[i].slot as usize, i); | ||||
|             assert_eq!(tower.lockouts.votes[i].confirmation_count as usize, 6 - i); | ||||
|             assert_eq!(tower.vote_state.votes[i].slot as usize, i); | ||||
|             assert_eq!(tower.vote_state.votes[i].confirmation_count as usize, 6 - i); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -2114,7 +2114,7 @@ pub mod test { | ||||
|         // If we set a root, then any lockout intervals below the root shouldn't | ||||
|         // count toward the switch threshold. This means the other validator's | ||||
|         // vote lockout no longer counts | ||||
|         tower.lockouts.root_slot = Some(43); | ||||
|         tower.vote_state.root_slot = Some(43); | ||||
|         // Refresh ancestors and descendants for new root. | ||||
|         let ancestors = vote_simulator.bank_forks.read().unwrap().ancestors(); | ||||
|         let descendants = vote_simulator | ||||
| @@ -2354,7 +2354,7 @@ pub mod test { | ||||
|                 .is_empty()); | ||||
|         } | ||||
|  | ||||
|         info!("local tower: {:#?}", tower.lockouts.votes); | ||||
|         info!("local tower: {:#?}", tower.vote_state.votes); | ||||
|         let observed = vote_simulator | ||||
|             .bank_forks | ||||
|             .read() | ||||
| @@ -2446,14 +2446,14 @@ pub mod test { | ||||
|         }; | ||||
|         let root_weight = root.lockout() as u128; | ||||
|         let vote_account_expected_weight = tower | ||||
|             .lockouts | ||||
|             .vote_state | ||||
|             .votes | ||||
|             .iter() | ||||
|             .map(|v| v.lockout() as u128) | ||||
|             .sum::<u128>() | ||||
|             + root_weight; | ||||
|         let expected_bank_weight = 2 * vote_account_expected_weight; | ||||
|         assert_eq!(tower.lockouts.root_slot, Some(0)); | ||||
|         assert_eq!(tower.vote_state.root_slot, Some(0)); | ||||
|         let mut latest_validator_votes_for_frozen_banks = | ||||
|             LatestValidatorVotesForFrozenBanks::default(); | ||||
|         let ComputedBankState { | ||||
| @@ -2530,7 +2530,7 @@ pub mod test { | ||||
|     fn test_is_locked_out_root_slot_child_pass() { | ||||
|         let mut tower = Tower::new_for_tests(0, 0.67); | ||||
|         let ancestors: HashSet<Slot> = vec![0].into_iter().collect(); | ||||
|         tower.lockouts.root_slot = Some(0); | ||||
|         tower.vote_state.root_slot = Some(0); | ||||
|         assert!(!tower.is_locked_out(1, &ancestors)); | ||||
|     } | ||||
|  | ||||
| @@ -2538,7 +2538,7 @@ pub mod test { | ||||
|     fn test_is_locked_out_root_slot_sibling_fail() { | ||||
|         let mut tower = Tower::new_for_tests(0, 0.67); | ||||
|         let ancestors: HashSet<Slot> = vec![0].into_iter().collect(); | ||||
|         tower.lockouts.root_slot = Some(0); | ||||
|         tower.vote_state.root_slot = Some(0); | ||||
|         tower.record_vote(1, Hash::default()); | ||||
|         assert!(tower.is_locked_out(2, &ancestors)); | ||||
|     } | ||||
| @@ -2599,10 +2599,10 @@ pub mod test { | ||||
|         tower.record_vote(1, Hash::default()); | ||||
|         assert!(!tower.is_locked_out(4, &ancestors)); | ||||
|         tower.record_vote(4, Hash::default()); | ||||
|         assert_eq!(tower.lockouts.votes[0].slot, 0); | ||||
|         assert_eq!(tower.lockouts.votes[0].confirmation_count, 2); | ||||
|         assert_eq!(tower.lockouts.votes[1].slot, 4); | ||||
|         assert_eq!(tower.lockouts.votes[1].confirmation_count, 1); | ||||
|         assert_eq!(tower.vote_state.votes[0].slot, 0); | ||||
|         assert_eq!(tower.vote_state.votes[0].confirmation_count, 2); | ||||
|         assert_eq!(tower.vote_state.votes[1].slot, 4); | ||||
|         assert_eq!(tower.vote_state.votes[1].confirmation_count, 1); | ||||
|     } | ||||
|  | ||||
|     #[test] | ||||
| @@ -2962,7 +2962,7 @@ pub mod test { | ||||
|             tower.record_vote(110, Hash::default()); | ||||
|             tower.record_vote(111, Hash::default()); | ||||
|             assert_eq!(tower.voted_slots(), vec![43, 110, 111]); | ||||
|             assert_eq!(tower.lockouts.root_slot, Some(0)); | ||||
|             assert_eq!(tower.vote_state.root_slot, Some(0)); | ||||
|         } | ||||
|  | ||||
|         // Prepare simulated validator restart! | ||||
| @@ -3062,7 +3062,7 @@ pub mod test { | ||||
|         tower.record_vote(110, Hash::default()); | ||||
|         tower.record_vote(111, Hash::default()); | ||||
|         assert_eq!(tower.voted_slots(), vec![110, 111]); | ||||
|         assert_eq!(tower.lockouts.root_slot, Some(replayed_root_slot)); | ||||
|         assert_eq!(tower.vote_state.root_slot, Some(replayed_root_slot)); | ||||
|     } | ||||
|  | ||||
|     #[test] | ||||
| @@ -3152,7 +3152,7 @@ pub mod test { | ||||
|             assert!(!blockstore.is_root(4)); | ||||
|  | ||||
|             let mut tower = Tower::new_with_key(&Pubkey::default()); | ||||
|             tower.lockouts.root_slot = Some(4); | ||||
|             tower.vote_state.root_slot = Some(4); | ||||
|             reconcile_blockstore_roots_with_tower(&tower, &blockstore).unwrap(); | ||||
|  | ||||
|             assert!(!blockstore.is_root(0)); | ||||
| @@ -3184,7 +3184,7 @@ pub mod test { | ||||
|             assert!(!blockstore.is_root(4)); | ||||
|  | ||||
|             let mut tower = Tower::new_with_key(&Pubkey::default()); | ||||
|             tower.lockouts.root_slot = Some(4); | ||||
|             tower.vote_state.root_slot = Some(4); | ||||
|             reconcile_blockstore_roots_with_tower(&tower, &blockstore).unwrap(); | ||||
|         } | ||||
|         Blockstore::destroy(&blockstore_path).expect("Expected successful database destruction"); | ||||
| @@ -3206,7 +3206,7 @@ pub mod test { | ||||
|             assert!(!blockstore.is_root(3)); | ||||
|  | ||||
|             let mut tower = Tower::new_with_key(&Pubkey::default()); | ||||
|             tower.lockouts.root_slot = Some(4); | ||||
|             tower.vote_state.root_slot = Some(4); | ||||
|             assert_eq!(blockstore.last_root(), 0); | ||||
|             reconcile_blockstore_roots_with_tower(&tower, &blockstore).unwrap(); | ||||
|             assert_eq!(blockstore.last_root(), 0); | ||||
| @@ -3358,7 +3358,7 @@ pub mod test { | ||||
|     #[test] | ||||
|     fn test_adjust_lockouts_after_replay_all_not_found_even_if_rooted() { | ||||
|         let mut tower = Tower::new_for_tests(10, 0.9); | ||||
|         tower.lockouts.root_slot = Some(4); | ||||
|         tower.vote_state.root_slot = Some(4); | ||||
|         tower.record_vote(5, Hash::default()); | ||||
|         tower.record_vote(6, Hash::default()); | ||||
|  | ||||
| @@ -3380,7 +3380,7 @@ pub mod test { | ||||
|     #[test] | ||||
|     fn test_adjust_lockouts_after_replay_all_future_votes_only_root_found() { | ||||
|         let mut tower = Tower::new_for_tests(10, 0.9); | ||||
|         tower.lockouts.root_slot = Some(2); | ||||
|         tower.vote_state.root_slot = Some(2); | ||||
|         tower.record_vote(3, Hash::default()); | ||||
|         tower.record_vote(4, Hash::default()); | ||||
|         tower.record_vote(5, Hash::default()); | ||||
| @@ -3436,8 +3436,8 @@ pub mod test { | ||||
|     #[test] | ||||
|     fn test_adjust_lockouts_after_replay_time_warped() { | ||||
|         let mut tower = Tower::new_for_tests(10, 0.9); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(1)); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(0)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(1)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(0)); | ||||
|         let vote = Vote::new(vec![0], Hash::default()); | ||||
|         tower.last_vote = vote; | ||||
|  | ||||
| @@ -3454,8 +3454,8 @@ pub mod test { | ||||
|     #[test] | ||||
|     fn test_adjust_lockouts_after_replay_diverged_ancestor() { | ||||
|         let mut tower = Tower::new_for_tests(10, 0.9); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(1)); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(2)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(1)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(2)); | ||||
|         let vote = Vote::new(vec![2], Hash::default()); | ||||
|         tower.last_vote = vote; | ||||
|  | ||||
| @@ -3476,11 +3476,11 @@ pub mod test { | ||||
|  | ||||
|         let mut tower = Tower::new_for_tests(10, 0.9); | ||||
|         tower | ||||
|             .lockouts | ||||
|             .vote_state | ||||
|             .votes | ||||
|             .push_back(Lockout::new(MAX_ENTRIES - 1)); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(0)); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(1)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(0)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(1)); | ||||
|         let vote = Vote::new(vec![1], Hash::default()); | ||||
|         tower.last_vote = vote; | ||||
|  | ||||
| @@ -3498,8 +3498,8 @@ pub mod test { | ||||
|     #[should_panic(expected = "slot_in_tower(2) < checked_slot(1)")] | ||||
|     fn test_adjust_lockouts_after_replay_reversed_votes() { | ||||
|         let mut tower = Tower::new_for_tests(10, 0.9); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(2)); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(1)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(2)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(1)); | ||||
|         let vote = Vote::new(vec![1], Hash::default()); | ||||
|         tower.last_vote = vote; | ||||
|  | ||||
| @@ -3516,9 +3516,9 @@ pub mod test { | ||||
|     #[should_panic(expected = "slot_in_tower(3) < checked_slot(3)")] | ||||
|     fn test_adjust_lockouts_after_replay_repeated_non_root_votes() { | ||||
|         let mut tower = Tower::new_for_tests(10, 0.9); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(2)); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(3)); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(3)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(2)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(3)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(3)); | ||||
|         let vote = Vote::new(vec![3], Hash::default()); | ||||
|         tower.last_vote = vote; | ||||
|  | ||||
| @@ -3534,10 +3534,10 @@ pub mod test { | ||||
|     #[test] | ||||
|     fn test_adjust_lockouts_after_replay_vote_on_root() { | ||||
|         let mut tower = Tower::new_for_tests(10, 0.9); | ||||
|         tower.lockouts.root_slot = Some(42); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(42)); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(43)); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(44)); | ||||
|         tower.vote_state.root_slot = Some(42); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(42)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(43)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(44)); | ||||
|         let vote = Vote::new(vec![44], Hash::default()); | ||||
|         tower.last_vote = vote; | ||||
|  | ||||
| @@ -3551,7 +3551,7 @@ pub mod test { | ||||
|     #[test] | ||||
|     fn test_adjust_lockouts_after_replay_vote_on_genesis() { | ||||
|         let mut tower = Tower::new_for_tests(10, 0.9); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(0)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(0)); | ||||
|         let vote = Vote::new(vec![0], Hash::default()); | ||||
|         tower.last_vote = vote; | ||||
|  | ||||
| @@ -3564,8 +3564,8 @@ pub mod test { | ||||
|     #[test] | ||||
|     fn test_adjust_lockouts_after_replay_future_tower() { | ||||
|         let mut tower = Tower::new_for_tests(10, 0.9); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(13)); | ||||
|         tower.lockouts.votes.push_back(Lockout::new(14)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(13)); | ||||
|         tower.vote_state.votes.push_back(Lockout::new(14)); | ||||
|         let vote = Vote::new(vec![14], Hash::default()); | ||||
|         tower.last_vote = vote; | ||||
|         tower.initialize_root(12); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user