From 14aaf79acd3ca6b5fd33d4481546d70a0277ce85 Mon Sep 17 00:00:00 2001 From: HaoranYi Date: Fri, 19 Aug 2022 16:04:24 -0500 Subject: [PATCH] Refactor epoch reward 1 (#27253) * refactor: extract store_stake_accounts fn * clippy: slice Co-authored-by: haoran --- runtime/src/bank.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index bd82888b932cf0..dcffc6cb987b7f 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -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| {