ReplayStage no longer relies on Validator to reset the poh recorder at start
This commit is contained in:
parent
84e3342612
commit
d0a8a16a57
|
@ -433,6 +433,14 @@ impl ReplayStage {
|
||||||
last_print_time: Instant::now(),
|
last_print_time: Instant::now(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Self::reset_poh_recorder(
|
||||||
|
&my_pubkey,
|
||||||
|
&blockstore,
|
||||||
|
&bank_forks.read().unwrap().working_bank(),
|
||||||
|
&poh_recorder,
|
||||||
|
&leader_schedule_cache,
|
||||||
|
);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
// Stop getting entries if we get exit signal
|
// Stop getting entries if we get exit signal
|
||||||
if exit.load(Ordering::Relaxed) {
|
if exit.load(Ordering::Relaxed) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ use {
|
||||||
solana_measure::measure::Measure,
|
solana_measure::measure::Measure,
|
||||||
solana_metrics::{datapoint_info, poh_timing_point::PohTimingSender},
|
solana_metrics::{datapoint_info, poh_timing_point::PohTimingSender},
|
||||||
solana_poh::{
|
solana_poh::{
|
||||||
poh_recorder::{PohRecorder, GRACE_TICKS_FACTOR, MAX_GRACE_SLOTS},
|
poh_recorder::PohRecorder,
|
||||||
poh_service::{self, PohService},
|
poh_service::{self, PohService},
|
||||||
},
|
},
|
||||||
solana_rpc::{
|
solana_rpc::{
|
||||||
|
@ -692,11 +692,11 @@ impl Validator {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
let bank = Arc::clone(&bank_forks.read().unwrap().working_bank());
|
|
||||||
info!("Starting validator with working bank slot {}", bank.slot());
|
|
||||||
|
|
||||||
let mut block_commitment_cache = BlockCommitmentCache::default();
|
let mut block_commitment_cache = BlockCommitmentCache::default();
|
||||||
block_commitment_cache.initialize_slots(bank.slot(), bank_forks.read().unwrap().root());
|
block_commitment_cache.initialize_slots(
|
||||||
|
bank_forks.read().unwrap().working_bank().slot(),
|
||||||
|
bank_forks.read().unwrap().root(),
|
||||||
|
);
|
||||||
let block_commitment_cache = Arc::new(RwLock::new(block_commitment_cache));
|
let block_commitment_cache = Arc::new(RwLock::new(block_commitment_cache));
|
||||||
|
|
||||||
let optimistically_confirmed_bank =
|
let optimistically_confirmed_bank =
|
||||||
|
@ -723,27 +723,14 @@ impl Validator {
|
||||||
max_slots.clone(),
|
max_slots.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
info!(
|
|
||||||
"Starting PoH: epoch={} slot={} tick_height={} blockhash={} leader={:?}",
|
|
||||||
bank.epoch(),
|
|
||||||
bank.slot(),
|
|
||||||
bank.tick_height(),
|
|
||||||
bank.last_blockhash(),
|
|
||||||
leader_schedule_cache.slot_leader_at(bank.slot(), Some(&bank))
|
|
||||||
);
|
|
||||||
|
|
||||||
let poh_config = Arc::new(genesis_config.poh_config.clone());
|
let poh_config = Arc::new(genesis_config.poh_config.clone());
|
||||||
let (poh_recorder, entry_receiver, record_receiver) = PohRecorder::new_with_clear_signal(
|
let (poh_recorder, entry_receiver, record_receiver) = {
|
||||||
|
let bank = &bank_forks.read().unwrap().working_bank();
|
||||||
|
PohRecorder::new_with_clear_signal(
|
||||||
bank.tick_height(),
|
bank.tick_height(),
|
||||||
bank.last_blockhash(),
|
bank.last_blockhash(),
|
||||||
bank.clone(),
|
bank.clone(),
|
||||||
leader_schedule_cache.next_leader_slot(
|
None,
|
||||||
&id,
|
|
||||||
bank.slot(),
|
|
||||||
&bank,
|
|
||||||
Some(&blockstore),
|
|
||||||
GRACE_TICKS_FACTOR * MAX_GRACE_SLOTS,
|
|
||||||
),
|
|
||||||
bank.ticks_per_slot(),
|
bank.ticks_per_slot(),
|
||||||
&id,
|
&id,
|
||||||
&blockstore,
|
&blockstore,
|
||||||
|
@ -752,7 +739,8 @@ impl Validator {
|
||||||
&poh_config,
|
&poh_config,
|
||||||
Some(poh_timing_point_sender),
|
Some(poh_timing_point_sender),
|
||||||
exit.clone(),
|
exit.clone(),
|
||||||
);
|
)
|
||||||
|
};
|
||||||
let poh_recorder = Arc::new(Mutex::new(poh_recorder));
|
let poh_recorder = Arc::new(Mutex::new(poh_recorder));
|
||||||
|
|
||||||
let rpc_override_health_check = Arc::new(AtomicBool::new(false));
|
let rpc_override_health_check = Arc::new(AtomicBool::new(false));
|
||||||
|
@ -898,7 +886,7 @@ impl Validator {
|
||||||
poh_recorder.clone(),
|
poh_recorder.clone(),
|
||||||
&poh_config,
|
&poh_config,
|
||||||
&exit,
|
&exit,
|
||||||
bank.ticks_per_slot(),
|
bank_forks.read().unwrap().root_bank().ticks_per_slot(),
|
||||||
config.poh_pinned_cpu_core,
|
config.poh_pinned_cpu_core,
|
||||||
config.poh_hashes_per_batch,
|
config.poh_hashes_per_batch,
|
||||||
record_receiver,
|
record_receiver,
|
||||||
|
|
Loading…
Reference in New Issue