Skip to content

Commit

Permalink
Fix bank new_from_field for epoch reward status (#34992)
Browse files Browse the repository at this point in the history
* fix bank new_from_field for epoch reward status

* fix bank serde test assert for epoch reward status

---------

Co-authored-by: HaoranYi <[email protected]>
  • Loading branch information
HaoranYi and HaoranYi authored Jan 29, 2024
1 parent 8fde8d2 commit b1f8a89
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 @@ -1853,7 +1853,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 b1f8a89

Please sign in to comment.