Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 5d318b8

Browse files
committed
remove clone in LeaderScheduleCache::new
1 parent 3f865c4 commit 5d318b8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ledger/src/leader_schedule_cache.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl LeaderScheduleCache {
4646
pub fn new(epoch_schedule: EpochSchedule, root_bank: &Bank) -> Self {
4747
let cache = Self {
4848
cached_schedules: RwLock::new((HashMap::new(), VecDeque::new())),
49-
epoch_schedule: epoch_schedule.clone(),
49+
epoch_schedule,
5050
max_epoch: RwLock::new(0),
5151
max_schedules: CacheCapacity::default(),
5252
fixed_schedule: None,
@@ -56,9 +56,11 @@ impl LeaderScheduleCache {
5656
cache.set_root(root_bank);
5757

5858
// Calculate the schedule for all epochs between 0 and leader_schedule_epoch(root)
59-
let leader_schedule_epoch = epoch_schedule.get_leader_schedule_epoch(root_bank.slot());
59+
let leader_schedule_epoch = cache
60+
.epoch_schedule
61+
.get_leader_schedule_epoch(root_bank.slot());
6062
for epoch in 0..leader_schedule_epoch {
61-
let first_slot_in_epoch = epoch_schedule.get_first_slot_in_epoch(epoch);
63+
let first_slot_in_epoch = cache.epoch_schedule.get_first_slot_in_epoch(epoch);
6264
cache.slot_leader_at(first_slot_in_epoch, Some(root_bank));
6365
}
6466
cache

0 commit comments

Comments
 (0)