remove unused filter_zero_balance (#4279)
This commit is contained in:
@ -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)> {
|
fn node_staked_accounts(bank: &Bank) -> impl Iterator<Item = (Pubkey, u64, Account)> {
|
||||||
bank.vote_accounts()
|
bank.vote_accounts()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|(account_id, account)| {
|
.map(|(account_id, account)| (account_id, Bank::read_balance(&account), account))
|
||||||
filter_zero_balances(&account).map(|stake| (account_id, stake, account))
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn node_staked_accounts_at_epoch(
|
pub fn node_staked_accounts_at_epoch(
|
||||||
bank: &Bank,
|
bank: &Bank,
|
||||||
epoch_height: u64,
|
epoch_height: u64,
|
||||||
) -> Option<impl Iterator<Item = (&Pubkey, u64, &Account)>> {
|
) -> Option<impl Iterator<Item = (&Pubkey, u64, &Account)>> {
|
||||||
bank.epoch_vote_accounts(epoch_height).map(|epoch_state| {
|
bank.epoch_vote_accounts(epoch_height).map(|vote_accounts| {
|
||||||
epoch_state
|
vote_accounts
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|(account_id, account)| {
|
.filter(|(account_id, account)| filter_no_delegate(account_id, account))
|
||||||
filter_zero_balances(account).map(|stake| (account_id, stake, account))
|
.map(|(account_id, account)| (account_id, Bank::read_balance(&account), account))
|
||||||
})
|
|
||||||
.filter(|(account_id, _, account)| filter_no_delegate(account_id, account))
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,15 +76,6 @@ fn filter_no_delegate(account_id: &Pubkey, account: &Account) -> bool {
|
|||||||
.unwrap_or(false)
|
.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(
|
fn to_vote_state(
|
||||||
node_staked_accounts: impl Iterator<Item = (impl Borrow<Pubkey>, u64, impl Borrow<Account>)>,
|
node_staked_accounts: impl Iterator<Item = (impl Borrow<Pubkey>, u64, impl Borrow<Account>)>,
|
||||||
) -> impl Iterator<Item = (u64, VoteState)> {
|
) -> impl Iterator<Item = (u64, VoteState)> {
|
||||||
|
Reference in New Issue
Block a user