renames solana_runtime::vote_account::VoteAccount

Rename:
  VoteAccount    -> VoteAccountInner  # the private type
  ArcVoteAccount -> VoteAccount       # the public type
This commit is contained in:
behzad nouri
2021-08-10 10:39:50 -04:00
parent 1403eaeefc
commit 00e5e12906
10 changed files with 115 additions and 112 deletions

View File

@ -26,7 +26,7 @@ use solana_runtime::{
commitment::VOTE_THRESHOLD_SIZE,
snapshot_utils::BankFromArchiveTimings,
transaction_batch::TransactionBatch,
vote_account::ArcVoteAccount,
vote_account::VoteAccount,
vote_sender_types::ReplayVoteSender,
};
use solana_sdk::{
@ -1140,7 +1140,7 @@ fn supermajority_root_from_vote_accounts<I>(
vote_accounts: I,
) -> Option<Slot>
where
I: IntoIterator<Item = (Pubkey, (u64, ArcVoteAccount))>,
I: IntoIterator<Item = (Pubkey, (u64, VoteAccount))>,
{
let mut roots_stakes: Vec<(Slot, u64)> = vote_accounts
.into_iter()
@ -3501,7 +3501,7 @@ pub mod tests {
#[allow(clippy::field_reassign_with_default)]
fn test_supermajority_root_from_vote_accounts() {
let convert_to_vote_accounts =
|roots_stakes: Vec<(Slot, u64)>| -> Vec<(Pubkey, (u64, ArcVoteAccount))> {
|roots_stakes: Vec<(Slot, u64)>| -> Vec<(Pubkey, (u64, VoteAccount))> {
roots_stakes
.into_iter()
.map(|(root, stake)| {
@ -3516,7 +3516,7 @@ pub mod tests {
VoteState::serialize(&versioned, vote_account.data_as_mut_slice()).unwrap();
(
solana_sdk::pubkey::new_rand(),
(stake, ArcVoteAccount::from(vote_account)),
(stake, VoteAccount::from(vote_account)),
)
})
.collect_vec()

View File

@ -61,31 +61,33 @@ where
#[cfg(test)]
pub(crate) mod tests {
use super::*;
use crate::genesis_utils::{
bootstrap_validator_stake_lamports, create_genesis_config, GenesisConfigInfo,
};
use rand::Rng;
use solana_runtime::vote_account::{ArcVoteAccount, VoteAccounts};
use solana_sdk::{
account::{from_account, AccountSharedData},
clock::Clock,
instruction::Instruction,
pubkey::Pubkey,
signature::{Keypair, Signer},
signers::Signers,
stake::{
instruction as stake_instruction,
state::{Authorized, Delegation, Lockup, Stake},
use {
super::*,
crate::genesis_utils::{
bootstrap_validator_stake_lamports, create_genesis_config, GenesisConfigInfo,
},
sysvar::stake_history::{self, StakeHistory},
transaction::Transaction,
rand::Rng,
solana_runtime::vote_account::{VoteAccount, VoteAccounts},
solana_sdk::{
account::{from_account, AccountSharedData},
clock::Clock,
instruction::Instruction,
pubkey::Pubkey,
signature::{Keypair, Signer},
signers::Signers,
stake::{
instruction as stake_instruction,
state::{Authorized, Delegation, Lockup, Stake},
},
sysvar::stake_history::{self, StakeHistory},
transaction::Transaction,
},
solana_vote_program::{
vote_instruction,
vote_state::{VoteInit, VoteState, VoteStateVersions},
},
std::sync::Arc,
};
use solana_vote_program::{
vote_instruction,
vote_state::{VoteInit, VoteState, VoteStateVersions},
};
use std::sync::Arc;
fn new_from_parent(parent: &Arc<Bank>, slot: Slot) -> Bank {
Bank::new_from_parent(parent, &Pubkey::default(), slot)
@ -317,7 +319,7 @@ pub(crate) mod tests {
)
.unwrap();
let vote_pubkey = Pubkey::new_unique();
(vote_pubkey, (stake, ArcVoteAccount::from(account)))
(vote_pubkey, (stake, VoteAccount::from(account)))
});
let result = vote_accounts.collect::<VoteAccounts>().staked_nodes();
assert_eq!(result.len(), 2);