move vote_accounts up (#3647)

This commit is contained in:
Rob Walker
2019-04-05 14:23:00 -07:00
committed by GitHub
parent 3fcca5bc0a
commit a5b5248a09
5 changed files with 133 additions and 207 deletions

View File

@ -345,7 +345,7 @@ impl Locktower {
fn bank_weight(&self, bank: &Bank, ancestors: &HashMap<u64, HashSet<u64>>) -> u128 {
let stake_lockouts =
self.collect_vote_lockouts(bank.slot(), bank.vote_accounts(), ancestors);
self.collect_vote_lockouts(bank.slot(), bank.vote_accounts().into_iter(), ancestors);
self.calculate_weight(&stake_lockouts)
}

View File

@ -403,7 +403,11 @@ impl ReplayStage {
.map(|bank| {
(
bank,
locktower.collect_vote_lockouts(bank.slot(), bank.vote_accounts(), &ancestors),
locktower.collect_vote_lockouts(
bank.slot(),
bank.vote_accounts().into_iter(),
&ancestors,
),
)
})
.filter(|(b, stake_lockouts)| {

View File

@ -53,9 +53,11 @@ pub fn delegated_stakes_at_epoch(bank: &Bank, epoch_height: u64) -> Option<HashM
/// Collect the node account balance and vote states for nodes have non-zero balance in
/// their corresponding staking accounts
fn node_staked_accounts(bank: &Bank) -> impl Iterator<Item = (Pubkey, u64, Account)> {
bank.vote_accounts().filter_map(|(account_id, account)| {
filter_zero_balances(&account).map(|stake| (account_id, stake, account))
})
bank.vote_accounts()
.into_iter()
.filter_map(|(account_id, account)| {
filter_zero_balances(&account).map(|stake| (account_id, stake, account))
})
}
pub fn node_staked_accounts_at_epoch(