epoch rewards are stored partitioned as Vec<Vec< (#32076)

* epoch rewards are stored partitioned as Vec<Vec<

* update comment
This commit is contained in:
Jeff Washington (jwash) 2023-06-12 15:06:22 -05:00 committed by GitHub
parent 7e7c286d50
commit 6280c63e1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -882,8 +882,8 @@ impl AbiExample for OptionalDropCallback {
pub(crate) struct StartBlockHeightAndRewards {
/// the block height of the slot at which rewards distribution began
pub(crate) start_block_height: u64,
/// calculated epoch rewards pending distribution
pub(crate) calculated_epoch_stake_rewards: Arc<StakeRewards>,
/// calculated epoch rewards pending distribution, outer Vec is by partition (one partition per block)
pub(crate) calculated_epoch_stake_rewards: Arc<Vec<StakeRewards>>,
}
/// Represent whether bank is in the reward phase or not.
@ -1446,7 +1446,7 @@ impl Bank {
}
#[allow(dead_code)]
pub(crate) fn set_epoch_reward_status_active(&mut self, stake_rewards: StakeRewards) {
pub(crate) fn set_epoch_reward_status_active(&mut self, stake_rewards: Vec<StakeRewards>) {
self.epoch_reward_status = EpochRewardStatus::Active(StartBlockHeightAndRewards {
start_block_height: self.block_height,
calculated_epoch_stake_rewards: Arc::new(stake_rewards),

View File

@ -513,7 +513,7 @@ fn test_extra_fields_eof() {
let sample_rewards = (0..2)
.map(|_| StakeReward::new_random())
.collect::<Vec<_>>();
for epoch_reward_status_active in [None, Some(vec![]), Some(sample_rewards)] {
for epoch_reward_status_active in [None, Some(vec![]), Some(vec![sample_rewards])] {
let (genesis_config, _) = create_genesis_config(500);
let bank0 = Arc::new(Bank::new_for_tests_with_config(
@ -618,7 +618,7 @@ fn test_extra_fields_full_snapshot_archive() {
let sample_rewards = (0..2)
.map(|_| StakeReward::new_random())
.collect::<Vec<_>>();
for epoch_reward_status_active in [None, Some(vec![]), Some(sample_rewards)] {
for epoch_reward_status_active in [None, Some(vec![]), Some(vec![sample_rewards])] {
let (mut genesis_config, _) = create_genesis_config(500);
activate_all_features(&mut genesis_config);
@ -786,7 +786,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 = "8LhKH71kTwmagxUGJA6Es58p8fejJsSAdgEmtL3xZdoY")]
#[frozen_abi(digest = "E783LfT75MPc1A9bqVtq3HsSkv3MP8kbssyJVYHA3erG")]
#[derive(Serialize, AbiExample)]
pub struct BankAbiTestWrapperNewer {
#[serde(serialize_with = "wrapper_newer")]