From 46ecac3310434be60f192c216b78a813ecda0a47 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Sat, 23 Mar 2019 13:07:09 -0700 Subject: [PATCH] Update leader slot in poh recorder if we skipped it (#3452) * reset poh recorder with the original start slot --- core/src/replay_stage.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/core/src/replay_stage.rs b/core/src/replay_stage.rs index cd31f4c711..91bce1aaf0 100644 --- a/core/src/replay_stage.rs +++ b/core/src/replay_stage.rs @@ -194,6 +194,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() {