Skip to content

Commit 1bfb375

Browse files
authored
block: populate caches with correct leader schedule epoch (#375)
1 parent 8656d0b commit 1bfb375

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/block.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,17 +358,17 @@ pub fn execute_block(context: BlockContext) -> Option<BlockEffects> {
358358

359359
let mut epoch_stakes: HashMap<Epoch, VersionedEpochStakes> = HashMap::new();
360360
epoch_stakes.insert(
361-
leader_schedule_epoch.saturating_sub(2),
361+
leader_schedule_epoch.saturating_sub(1),
362362
VersionedEpochStakes::new(
363363
SerdeStakesToStakeFormat::from(stakes_t_2),
364-
leader_schedule_epoch.saturating_sub(2),
364+
leader_schedule_epoch.saturating_sub(1),
365365
),
366366
);
367367
epoch_stakes.insert(
368-
leader_schedule_epoch.saturating_sub(1),
368+
leader_schedule_epoch,
369369
VersionedEpochStakes::new(
370370
SerdeStakesToStakeFormat::from(stakes_t_1.clone()),
371-
leader_schedule_epoch.saturating_sub(1),
371+
leader_schedule_epoch,
372372
),
373373
);
374374

@@ -383,10 +383,10 @@ pub fn execute_block(context: BlockContext) -> Option<BlockEffects> {
383383
})
384384
.unwrap();
385385
epoch_stakes.insert(
386-
leader_schedule_epoch,
386+
leader_schedule_epoch.saturating_add(1),
387387
VersionedEpochStakes::new(
388388
SerdeStakesToStakeFormat::from(stakes_current_accounts),
389-
leader_schedule_epoch,
389+
leader_schedule_epoch.saturating_add(1),
390390
),
391391
);
392392

@@ -480,10 +480,10 @@ pub fn execute_block(context: BlockContext) -> Option<BlockEffects> {
480480
bank.block_height(),
481481
null_tracer(),
482482
);
483-
} else {
484-
bank.distribute_partitioned_epoch_rewards();
485483
}
486484

485+
bank.distribute_partitioned_epoch_rewards();
486+
487487
bank.get_transaction_processor().reset_sysvar_cache();
488488
bank.update_slot_hashes();
489489
bank.update_stake_history(Some(parent_epoch));

0 commit comments

Comments
 (0)