solana_program/vote/state/
vote_state_1_14_11.rsuse super::*;
const DEFAULT_PRIOR_VOTERS_OFFSET: usize = 82;
#[frozen_abi(digest = "CZTgLymuevXjAx6tM8X8T5J3MCx9AkEsFSmu4FJrEpkG")]
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq, Clone, AbiExample)]
pub struct VoteState1_14_11 {
pub node_pubkey: Pubkey,
pub authorized_withdrawer: Pubkey,
pub commission: u8,
pub votes: VecDeque<Lockout>,
pub root_slot: Option<Slot>,
pub authorized_voters: AuthorizedVoters,
pub prior_voters: CircBuf<(Pubkey, Epoch, Epoch)>,
pub epoch_credits: Vec<(Epoch, u64, u64)>,
pub last_timestamp: BlockTimestamp,
}
impl VoteState1_14_11 {
pub fn get_rent_exempt_reserve(rent: &Rent) -> u64 {
rent.minimum_balance(Self::size_of())
}
pub fn size_of() -> usize {
3731 }
pub fn is_correct_size_and_initialized(data: &[u8]) -> bool {
const VERSION_OFFSET: usize = 4;
const DEFAULT_PRIOR_VOTERS_END: usize = VERSION_OFFSET + DEFAULT_PRIOR_VOTERS_OFFSET;
data.len() == VoteState1_14_11::size_of()
&& data[VERSION_OFFSET..DEFAULT_PRIOR_VOTERS_END] != [0; DEFAULT_PRIOR_VOTERS_OFFSET]
}
}
impl From<VoteState> for VoteState1_14_11 {
fn from(vote_state: VoteState) -> Self {
Self {
node_pubkey: vote_state.node_pubkey,
authorized_withdrawer: vote_state.authorized_withdrawer,
commission: vote_state.commission,
votes: vote_state
.votes
.into_iter()
.map(|landed_vote| landed_vote.into())
.collect(),
root_slot: vote_state.root_slot,
authorized_voters: vote_state.authorized_voters,
prior_voters: vote_state.prior_voters,
epoch_credits: vote_state.epoch_credits,
last_timestamp: vote_state.last_timestamp,
}
}
}