Skip to content

Commit

Permalink
v1.18: Fix bank new_from_field for epoch reward status (backport of #…
Browse files Browse the repository at this point in the history
…34992) (#35002)

Fix bank new_from_field for epoch reward status (#34992)

* fix bank new_from_field for epoch reward status

* fix bank serde test assert for epoch reward status

---------

Co-authored-by: HaoranYi <[email protected]>
(cherry picked from commit b1f8a89)

Co-authored-by: HaoranYi <[email protected]>
  • Loading branch information
mergify[bot] and HaoranYi authored Jan 31, 2024
1 parent 021e555 commit 5d824a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1840,7 +1840,7 @@ impl Bank {
fields.epoch,
))),
check_program_modification_slot: false,
epoch_reward_status: EpochRewardStatus::default(),
epoch_reward_status: fields.epoch_reward_status,
};
bank.finish_init(
genesis_config,
Expand Down
6 changes: 3 additions & 3 deletions runtime/src/bank/serde_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ mod tests {
);

// assert epoch_reward_status is the same as the set epoch reward status
let epoch_reward_status = bank
let epoch_reward_status = dbank
.get_epoch_reward_status_to_serialize()
.unwrap_or(&EpochRewardStatus::Inactive);
if let Some(rewards) = epoch_reward_status_active {
Expand Down Expand Up @@ -504,7 +504,7 @@ mod tests {
);

// assert epoch_reward_status is the same as the set epoch reward status
let epoch_reward_status = bank
let epoch_reward_status = dbank
.get_epoch_reward_status_to_serialize()
.unwrap_or(&EpochRewardStatus::Inactive);
if let Some(rewards) = epoch_reward_status_active {
Expand Down Expand Up @@ -593,7 +593,7 @@ mod tests {
assert_eq!(0, dbank.fee_rate_governor.lamports_per_signature);

// epoch_reward status should default to `Inactive`
let epoch_reward_status = bank
let epoch_reward_status = dbank
.get_epoch_reward_status_to_serialize()
.unwrap_or(&EpochRewardStatus::Inactive);
assert_matches!(epoch_reward_status, EpochRewardStatus::Inactive);
Expand Down

0 comments on commit 5d824a3

Please sign in to comment.