remove unused filter_zero_balance (#4279)

This commit is contained in:
Rob Walker 2019-05-14 10:44:29 -07:00 committed by GitHub
parent e8ad822111
commit 0f498e6265
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 18 deletions

View File

@ -55,22 +55,18 @@ pub fn delegated_stakes_at_epoch(bank: &Bank, epoch_height: u64) -> Option<HashM
fn node_staked_accounts(bank: &Bank) -> impl Iterator<Item = (Pubkey, u64, Account)> {
bank.vote_accounts()
.into_iter()
.filter_map(|(account_id, account)| {
filter_zero_balances(&account).map(|stake| (account_id, stake, account))
})
.map(|(account_id, account)| (account_id, Bank::read_balance(&account), account))
}
pub fn node_staked_accounts_at_epoch(
bank: &Bank,
epoch_height: u64,
) -> Option<impl Iterator<Item = (&Pubkey, u64, &Account)>> {
bank.epoch_vote_accounts(epoch_height).map(|epoch_state| {
epoch_state
bank.epoch_vote_accounts(epoch_height).map(|vote_accounts| {
vote_accounts
.into_iter()
.filter_map(|(account_id, account)| {
filter_zero_balances(account).map(|stake| (account_id, stake, account))
})
.filter(|(account_id, _, account)| filter_no_delegate(account_id, account))
.filter(|(account_id, account)| filter_no_delegate(account_id, account))
.map(|(account_id, account)| (account_id, Bank::read_balance(&account), account))
})
}
@ -80,15 +76,6 @@ fn filter_no_delegate(account_id: &Pubkey, account: &Account) -> bool {
.unwrap_or(false)
}
fn filter_zero_balances(account: &Account) -> Option<u64> {
let balance = Bank::read_balance(&account);
if balance > 0 {
Some(balance)
} else {
None
}
}
fn to_vote_state(
node_staked_accounts: impl Iterator<Item = (impl Borrow<Pubkey>, u64, impl Borrow<Account>)>,
) -> impl Iterator<Item = (u64, VoteState)> {