Remove unnecessary Option (#21569)
This commit is contained in:
@ -68,11 +68,8 @@ impl Stakes {
|
|||||||
.vote_accounts
|
.vote_accounts
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(pubkey, (_ /*stake*/, account))| {
|
.map(|(pubkey, (_ /*stake*/, account))| {
|
||||||
let stake = self.calculate_stake(
|
let stake =
|
||||||
pubkey,
|
self.calculate_stake(pubkey, next_epoch, &stake_history_upto_prev_epoch);
|
||||||
next_epoch,
|
|
||||||
Some(&stake_history_upto_prev_epoch),
|
|
||||||
);
|
|
||||||
(*pubkey, (stake, account.clone()))
|
(*pubkey, (stake, account.clone()))
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
@ -159,13 +156,14 @@ impl Stakes {
|
|||||||
&self,
|
&self,
|
||||||
voter_pubkey: &Pubkey,
|
voter_pubkey: &Pubkey,
|
||||||
epoch: Epoch,
|
epoch: Epoch,
|
||||||
stake_history: Option<&StakeHistory>,
|
stake_history: &StakeHistory,
|
||||||
) -> u64 {
|
) -> u64 {
|
||||||
let matches_voter_pubkey = |(_, stake_delegation): &(&_, &Delegation)| {
|
let matches_voter_pubkey = |(_, stake_delegation): &(&_, &Delegation)| {
|
||||||
&stake_delegation.voter_pubkey == voter_pubkey
|
&stake_delegation.voter_pubkey == voter_pubkey
|
||||||
};
|
};
|
||||||
let get_stake =
|
let get_stake = |(_, stake_delegation): (_, &Delegation)| {
|
||||||
|(_, stake_delegation): (_, &Delegation)| stake_delegation.stake(epoch, stake_history);
|
stake_delegation.stake(epoch, Some(stake_history))
|
||||||
|
};
|
||||||
|
|
||||||
self.stake_delegations
|
self.stake_delegations
|
||||||
.iter()
|
.iter()
|
||||||
@ -205,7 +203,7 @@ impl Stakes {
|
|||||||
if account.lamports() != 0 && VoteState::is_correct_size_and_initialized(account.data())
|
if account.lamports() != 0 && VoteState::is_correct_size_and_initialized(account.data())
|
||||||
{
|
{
|
||||||
let stake = old.as_ref().map_or_else(
|
let stake = old.as_ref().map_or_else(
|
||||||
|| self.calculate_stake(pubkey, self.epoch, Some(&self.stake_history)),
|
|| self.calculate_stake(pubkey, self.epoch, &self.stake_history),
|
||||||
|v| v.0,
|
|v| v.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user