persist EpochRewardStatus::Active (#31697)

persist `EpochRewardStatus::Active`
This commit is contained in:
Jeff Washington (jwash) 2023-05-18 09:14:41 -05:00 committed by GitHub
parent c5d72fc480
commit 0291454876
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View File

@ -7730,6 +7730,13 @@ impl Bank {
Some(epoch_accounts_hash)
}
/// Return the epoch_reward_status field on the bank to serialize
/// Returns none if we are NOT in the reward interval.
pub(crate) fn get_epoch_reward_status_to_serialize(&self) -> Option<&EpochRewardStatus> {
matches!(self.epoch_reward_status, EpochRewardStatus::Active(_))
.then_some(&self.epoch_reward_status)
}
/// Convenience fn to get the Epoch Accounts Hash
pub fn epoch_accounts_hash(&self) -> Option<EpochAccountsHash> {
self.rc

View File

@ -202,7 +202,9 @@ impl<'a> TypeContext<'a> for Context {
let ancestors = HashMap::from(&serializable_bank.bank.ancestors);
let fields = serializable_bank.bank.get_fields_to_serialize(&ancestors);
let lamports_per_signature = fields.fee_rate_governor.lamports_per_signature;
let epoch_reward_status = None;
let epoch_reward_status = serializable_bank
.bank
.get_epoch_reward_status_to_serialize();
match get_serialize_bank_fields(
SerializableVersionedBank::from(fields),
SerializableAccountsDb::<'a, Self> {

View File

@ -721,7 +721,7 @@ mod test_bank_serialize {
// This some what long test harness is required to freeze the ABI of
// Bank's serialization due to versioned nature
#[frozen_abi(digest = "GbEcrk8sgqbQ5kJ8mAaHTh2REmHyESQ6GXnGWxkGbxDe")]
#[frozen_abi(digest = "8aBQnNxnfKDxGEmMwaq9uLeMh3fw5sKsMGZBsCp15Dmv")]
#[derive(Serialize, AbiExample)]
pub struct BankAbiTestWrapperNewer {
#[serde(serialize_with = "wrapper_newer")]