diff --git a/ledger/src/leader_schedule_cache.rs b/ledger/src/leader_schedule_cache.rs index 4b07807b40d174..a1607ab0cb3a46 100644 --- a/ledger/src/leader_schedule_cache.rs +++ b/ledger/src/leader_schedule_cache.rs @@ -46,7 +46,7 @@ impl LeaderScheduleCache { pub fn new(epoch_schedule: EpochSchedule, root_bank: &Bank) -> Self { let cache = Self { cached_schedules: RwLock::new((HashMap::new(), VecDeque::new())), - epoch_schedule: epoch_schedule.clone(), + epoch_schedule, max_epoch: RwLock::new(0), max_schedules: CacheCapacity::default(), fixed_schedule: None, @@ -56,9 +56,11 @@ impl LeaderScheduleCache { cache.set_root(root_bank); // Calculate the schedule for all epochs between 0 and leader_schedule_epoch(root) - let leader_schedule_epoch = epoch_schedule.get_leader_schedule_epoch(root_bank.slot()); + let leader_schedule_epoch = cache + .epoch_schedule + .get_leader_schedule_epoch(root_bank.slot()); for epoch in 0..leader_schedule_epoch { - let first_slot_in_epoch = epoch_schedule.get_first_slot_in_epoch(epoch); + let first_slot_in_epoch = cache.epoch_schedule.get_first_slot_in_epoch(epoch); cache.slot_leader_at(first_slot_in_epoch, Some(root_bank)); } cache