remove unused filter_zero_balance (#4279)
This commit is contained in:
parent
e8ad822111
commit
0f498e6265
|
@ -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)> {
|
||||
|
|
Loading…
Reference in New Issue