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

Commit

Permalink
Fix slot index used while calculating leader schedule
Browse files Browse the repository at this point in the history
- slot_leader_at() was using absolute slot number instead of index in the epoch
  • Loading branch information
pgarg66 authored and solana-grimes committed Feb 28, 2019
1 parent 1c44b73 commit 30bccc0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/leader_schedule_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ pub fn slot_leader(bank: &Bank) -> Pubkey {

/// Return the leader for the given slot.
pub fn slot_leader_at(slot: u64, bank: &Bank) -> Pubkey {
let epoch = slot / bank.slots_per_epoch();
slot_leader_by(bank, |_, _, _| (slot, epoch))
slot_leader_by(bank, |_, _, _| {
(slot % bank.slots_per_epoch(), slot / bank.slots_per_epoch())
})
}

/// Return the epoch height and slot index of the slot before the current slot.
Expand Down

0 comments on commit 30bccc0

Please sign in to comment.