diff --git a/src/banking_stage.rs b/src/banking_stage.rs index 85ed0db12f..6e0fdb9043 100644 --- a/src/banking_stage.rs +++ b/src/banking_stage.rs @@ -53,14 +53,8 @@ impl BankingStage { ) -> (Self, Receiver>) { let (entry_sender, entry_receiver) = channel(); let shared_verified_receiver = Arc::new(Mutex::new(verified_receiver)); - let poh_recorder = PohRecorder::new( - bank.clone(), - entry_sender, - *last_entry_id, - max_tick_height, - false, - vec![], - ); + let poh_recorder = + PohRecorder::new(bank.clone(), entry_sender, *last_entry_id, max_tick_height); // Single thread to generate entries from many banks. // This thread talks to poh_service and broadcasts the entries once they have been recorded. diff --git a/src/poh_recorder.rs b/src/poh_recorder.rs index bcbd4ea030..bfee2039d0 100644 --- a/src/poh_recorder.rs +++ b/src/poh_recorder.rs @@ -18,15 +18,10 @@ pub enum PohRecorderError { #[derive(Clone)] pub struct PohRecorder { - is_virtual: bool, - virtual_tick_entries: Arc>>, poh: Arc>, bank: Arc, sender: Sender>, - // TODO: whe extracting PoH generator into a separate standalone service, - // use this field for checking timeouts when running as a validator, and as - // a transmission guard when running as the leader. - pub max_tick_height: Option, + max_tick_height: Option, } impl PohRecorder { @@ -49,9 +44,6 @@ impl PohRecorder { let mut poh = self.poh.lock().unwrap(); if self.is_max_tick_height_reached(&poh) { Err(Error::PohRecorderError(PohRecorderError::MaxHeightReached)) - } else if self.is_virtual { - self.generate_and_store_tick(&mut *poh); - Ok(()) } else { self.register_and_send_tick(&mut *poh)?; Ok(()) @@ -59,11 +51,6 @@ impl PohRecorder { } pub fn record(&self, mixin: Hash, txs: Vec) -> Result<()> { - if self.is_virtual { - return Err(Error::PohRecorderError( - PohRecorderError::InvalidCallingObject, - )); - } // Register and send the entry out while holding the lock. // This guarantees PoH order and Entry production and banks LastId queue is the same. let mut poh = self.poh.lock().unwrap(); @@ -83,18 +70,13 @@ impl PohRecorder { sender: Sender>, last_entry_id: Hash, max_tick_height: Option, - is_virtual: bool, - virtual_tick_entries: Vec, ) -> Self { let poh = Arc::new(Mutex::new(Poh::new(last_entry_id, bank.tick_height()))); - let virtual_tick_entries = Arc::new(Mutex::new(virtual_tick_entries)); PohRecorder { poh, bank, sender, max_tick_height, - is_virtual, - virtual_tick_entries, } } @@ -127,11 +109,6 @@ impl PohRecorder { Ok(()) } - fn generate_and_store_tick(&self, poh: &mut Poh) { - let tick_entry = self.generate_tick_entry(poh); - self.virtual_tick_entries.lock().unwrap().push(tick_entry); - } - fn register_and_send_tick(&self, poh: &mut Poh) -> Result<()> { let tick_entry = self.generate_tick_entry(poh); self.bank.register_tick(&tick_entry.id); @@ -155,7 +132,7 @@ mod tests { let bank = Arc::new(Bank::new(&mint)); let last_id = bank.last_id(); let (entry_sender, entry_receiver) = channel(); - let mut poh_recorder = PohRecorder::new(bank, entry_sender, last_id, None, false, vec![]); + let mut poh_recorder = PohRecorder::new(bank, entry_sender, last_id, None); //send some data let h1 = hash(b"hello world!");