Add local cluster test to repro slot hash expiry bug (#21873)

This commit is contained in:
Ashwin Sekar
2022-01-10 00:58:21 -05:00
committed by GitHub
parent 39327ec753
commit eeec1ce2ad
4 changed files with 250 additions and 9 deletions

View File

@ -105,7 +105,7 @@ pub(crate) struct ComputedBankState {
#[frozen_abi(digest = "GMs1FxKteU7K4ZFRofMBqNhBpM4xkPVxfYod6R8DQmpT")]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, AbiExample)]
pub struct Tower {
pub(crate) node_pubkey: Pubkey,
pub node_pubkey: Pubkey,
threshold_depth: usize,
threshold_size: f64,
vote_state: VoteState,
@ -432,6 +432,13 @@ impl Tower {
self.record_bank_vote_and_update_lockouts(slot, hash, self.last_voted_slot())
}
/// Used for tests
pub fn increase_lockout(&mut self, confirmation_count_increase: u32) {
for vote in self.vote_state.votes.iter_mut() {
vote.confirmation_count += confirmation_count_increase;
}
}
pub fn last_voted_slot(&self) -> Option<Slot> {
self.last_vote.slots.last().copied()
}