@ -233,7 +233,7 @@ mod tests {
|
||||
use crate::genesis_utils::{create_genesis_config, GenesisConfigInfo};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_stake_program::stake_state;
|
||||
use solana_vote_program::vote_state;
|
||||
use solana_vote_program::vote_state::{self, VoteStateVersions};
|
||||
|
||||
#[test]
|
||||
fn test_block_commitment() {
|
||||
@ -446,13 +446,15 @@ mod tests {
|
||||
let mut vote_state1 = VoteState::from(&vote_account1).unwrap();
|
||||
vote_state1.process_slot_vote_unchecked(3);
|
||||
vote_state1.process_slot_vote_unchecked(5);
|
||||
vote_state1.to(&mut vote_account1).unwrap();
|
||||
let versioned = VoteStateVersions::Current(Box::new(vote_state1));
|
||||
VoteState::to(&versioned, &mut vote_account1).unwrap();
|
||||
bank.store_account(&pk1, &vote_account1);
|
||||
|
||||
let mut vote_state2 = VoteState::from(&vote_account2).unwrap();
|
||||
vote_state2.process_slot_vote_unchecked(9);
|
||||
vote_state2.process_slot_vote_unchecked(10);
|
||||
vote_state2.to(&mut vote_account2).unwrap();
|
||||
let versioned = VoteStateVersions::Current(Box::new(vote_state2));
|
||||
VoteState::to(&versioned, &mut vote_account2).unwrap();
|
||||
bank.store_account(&pk2, &vote_account2);
|
||||
|
||||
let commitment = AggregateCommitmentService::aggregate_commitment(&ancestors, &bank);
|
||||
|
@ -483,7 +483,10 @@ pub mod test {
|
||||
signature::{Keypair, Signer},
|
||||
transaction::Transaction,
|
||||
};
|
||||
use solana_vote_program::{vote_instruction, vote_state::Vote};
|
||||
use solana_vote_program::{
|
||||
vote_instruction,
|
||||
vote_state::{Vote, VoteStateVersions},
|
||||
};
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
use std::sync::RwLock;
|
||||
use std::{thread::sleep, time::Duration};
|
||||
@ -706,9 +709,11 @@ pub mod test {
|
||||
for slot in *votes {
|
||||
vote_state.process_slot_vote_unchecked(*slot);
|
||||
}
|
||||
vote_state
|
||||
.serialize(&mut account.data)
|
||||
.expect("serialize state");
|
||||
VoteState::serialize(
|
||||
&VoteStateVersions::Current(Box::new(vote_state)),
|
||||
&mut account.data,
|
||||
)
|
||||
.expect("serialize state");
|
||||
stakes.push((Pubkey::new_rand(), (*lamports, account)));
|
||||
}
|
||||
stakes
|
||||
|
@ -1099,7 +1099,7 @@ pub(crate) mod tests {
|
||||
transaction::TransactionError,
|
||||
};
|
||||
use solana_stake_program::stake_state;
|
||||
use solana_vote_program::vote_state::{self, Vote, VoteState};
|
||||
use solana_vote_program::vote_state::{self, Vote, VoteState, VoteStateVersions};
|
||||
use std::{
|
||||
fs::remove_dir_all,
|
||||
iter,
|
||||
@ -1134,7 +1134,8 @@ pub(crate) mod tests {
|
||||
let mut vote_account = bank.get_account(&pubkey).unwrap();
|
||||
let mut vote_state = VoteState::from(&vote_account).unwrap();
|
||||
vote_state.process_slot_vote_unchecked(slot);
|
||||
vote_state.to(&mut vote_account).unwrap();
|
||||
let versioned = VoteStateVersions::Current(Box::new(vote_state));
|
||||
VoteState::to(&versioned, &mut vote_account).unwrap();
|
||||
bank.store_account(&pubkey, &vote_account);
|
||||
}
|
||||
|
||||
@ -1718,7 +1719,8 @@ pub(crate) mod tests {
|
||||
let mut leader_vote_account = bank.get_account(&pubkey).unwrap();
|
||||
let mut vote_state = VoteState::from(&leader_vote_account).unwrap();
|
||||
vote_state.process_slot_vote_unchecked(bank.slot());
|
||||
vote_state.to(&mut leader_vote_account).unwrap();
|
||||
let versioned = VoteStateVersions::Current(Box::new(vote_state));
|
||||
VoteState::to(&versioned, &mut leader_vote_account).unwrap();
|
||||
bank.store_account(&pubkey, &leader_vote_account);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user