Skip to content

Commit

Permalink
deactivate_epoch_rewards_status burns sysvar (#32143)
Browse files Browse the repository at this point in the history
* deactivate_epoch_reward_status burns sysvar

* warn to info

---------

Co-authored-by: HaoranYi <[email protected]>
  • Loading branch information
jeffwashington and HaoranYi authored Jun 15, 2023
1 parent eabe107 commit 988bff9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1846,12 +1846,24 @@ impl Bank {

#[allow(dead_code)]
/// partitioned reward distribution is complete.
/// So, deactivate the epoch rewards sysvar.
fn deactivate_epoch_reward_status(&mut self) {
assert!(matches!(
self.epoch_reward_status,
EpochRewardStatus::Active(_)
));
self.epoch_reward_status = EpochRewardStatus::Inactive;
if let Some(account) = self.get_account(&sysvar::epoch_rewards::id()) {
if account.lamports() > 0 {
info!(
"burning {} extra lamports in EpochRewards sysvar account at slot {}",
account.lamports(),
self.slot()
);
self.log_epoch_rewards_sysvar("burn");
self.burn_and_purge_account(&sysvar::epoch_rewards::id(), account);
}
}
}

#[allow(dead_code)]
Expand Down

0 comments on commit 988bff9

Please sign in to comment.