update begin_partitioned_rewards to include sysvar (#32151)

* update begin_partitioned_rewards to include sysvar

* cleanup
This commit is contained in:
Jeff Washington (jwash) 2023-06-15 16:00:24 -05:00 committed by GitHub
parent a875562ccd
commit b4265217e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -1897,8 +1897,9 @@ impl Bank {
rewards_metrics: &mut RewardsMetrics,
) {
let CalculateRewardsAndDistributeVoteRewardsResult {
total_rewards,
distributed_rewards,
stake_rewards_by_partition,
..
} = self.calculate_rewards_and_distribute_vote_rewards(
parent_epoch,
reward_calc_tracer,
@ -1907,8 +1908,15 @@ impl Bank {
);
let slot = self.slot();
let credit_start = self.block_height() + self.get_reward_calculation_num_blocks();
let credit_end_exclusive = credit_start + stake_rewards_by_partition.len() as u64;
self.set_epoch_reward_status_active(stake_rewards_by_partition);
// create EpochRewards sysvar that holds the balance of undistributed rewards with
// (total_rewards, distributed_rewards, credit_end_exclusive), total capital will increase by (total_rewards - distributed_rewards)
self.create_epoch_rewards_sysvar(total_rewards, distributed_rewards, credit_end_exclusive);
datapoint_info!(
"epoch-rewards-status-update",
("start_slot", slot, i64),