Fix vote_balance_and_staked

This commit is contained in:
Ryo Onodera
2020-07-18 00:08:44 +09:00
parent f19e2e79ba
commit 0a72e3cfe0

View File

@@ -88,10 +88,15 @@ impl Stakes {
}
pub fn vote_balance_and_staked(&self) -> u64 {
self.vote_accounts
self.stake_delegations
.iter()
.map(|(_pubkey, (staked, account))| staked + account.lamports)
.sum()
.map(|(_, stake_delegation)| stake_delegation.stake)
.sum::<u64>()
+ self
.vote_accounts
.iter()
.map(|(_pubkey, (_staked, vote_account))| vote_account.lamports)
.sum::<u64>()
}
pub fn is_stake(account: &Account) -> bool {