deactivate_epoch_rewards_status burns sysvar (#32143)

* deactivate_epoch_reward_status burns sysvar

* warn to info

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
This commit is contained in:
Jeff Washington (jwash) 2023-06-15 10:36:50 -05:00 committed by GitHub
parent eabe107066
commit 988bff93c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -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)]