Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Refactor epoch reward 1 #27253

Merged
merged 2 commits into from
Aug 19, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3182,14 +3182,7 @@ impl Bank {
m.stop();
metrics.redeem_rewards_us += m.as_us();

// 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);
self.store_stake_accounts(&stake_rewards, metrics);

let mut m = Measure::start("store_vote_accounts");
let mut vote_rewards = vote_account_rewards
Expand Down Expand Up @@ -3239,6 +3232,17 @@ impl Bank {
point_value.rewards as f64 / point_value.points as f64
}

fn store_stake_accounts(&self, stake_rewards: &Vec<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