Skip to content

Commit

Permalink
Update leader slot in poh recorder if we skipped it (#3451)
Browse files Browse the repository at this point in the history
* reset poh recorder with the original start slot
  • Loading branch information
pgarg66 authored Mar 23, 2019
1 parent b91afb7 commit f479021
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions core/src/replay_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,25 @@ impl ReplayStage {
trace!("{} checking poh slot {}", my_id, poh_slot);
if blocktree.meta(poh_slot).unwrap().is_some() {
// We've already broadcasted entries for this slot, skip it

// Since we are skipping our leader slot, let's tell poh recorder when we should be
// leader again
if reached_leader_tick {
let _ = bank_forks.read().unwrap().get(poh_slot).map(|bank| {
let next_leader_slot =
leader_schedule_utils::next_leader_slot(&my_id, bank.slot(), &bank);
let mut poh = poh_recorder.lock().unwrap();
let start_slot = poh.start_slot();
poh.reset(
bank.tick_height(),
bank.last_blockhash(),
start_slot,
next_leader_slot,
bank.ticks_per_slot(),
);
});
}

return;
}
if bank_forks.read().unwrap().get(poh_slot).is_none() {
Expand Down

0 comments on commit f479021

Please sign in to comment.