Skip to content

Commit

Permalink
Refactor epoch reward 1 (solana-labs#27253)
Browse files Browse the repository at this point in the history
* refactor: extract store_stake_accounts fn

* clippy: slice

Co-authored-by: haoran <haoran@mbook>
  • Loading branch information
HaoranYi and haoran committed Aug 21, 2022
1 parent 0721fe6 commit 14aaf79
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3280,6 +3280,17 @@ impl Bank {
.for_each(|x| rewards.push((x.stake_pubkey, x.stake_reward_info)));
}

fn store_stake_accounts(&self, stake_rewards: &[StakeReward], metrics: &mut RewardsMetrics) {
// store stake account even if stakers_reward is 0
// because credits observed has changed
let mut m = Measure::start("store_stake_account");
self.store_accounts((self.slot(), stake_rewards));
m.stop();
metrics
.store_stake_accounts_us
.fetch_add(m.as_us(), Relaxed);
}

fn update_recent_blockhashes_locked(&self, locked_blockhash_queue: &BlockhashQueue) {
#[allow(deprecated)]
self.update_sysvar_account(&sysvar::recent_blockhashes::id(), |account| {
Expand Down

0 comments on commit 14aaf79

Please sign in to comment.