From 45a7c6edfb7ce5ea7f88f1a5c5e8e6fc83bcee44 Mon Sep 17 00:00:00 2001 From: HaoranYi Date: Mon, 21 Mar 2022 18:35:31 -0500 Subject: [PATCH] Fix typos and a small refactor (#23805) * fix typo * remove packet_has_more_unprocessed_transactions function --- core/src/banking_stage.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/core/src/banking_stage.rs b/core/src/banking_stage.rs index 94174821a2..590231de2d 100644 --- a/core/src/banking_stage.rs +++ b/core/src/banking_stage.rs @@ -1,5 +1,5 @@ //! The `banking_stage` processes Transaction messages. It is intended to be used -//! to contruct a software pipeline. The stage uses all available CPU cores and +//! to construct a software pipeline. The stage uses all available CPU cores and //! can do its processing in parallel with signature verification on the GPU. use { crate::{ @@ -194,7 +194,7 @@ impl BankingStageStats { } fn report(&mut self, report_interval_ms: u64) { - // skip repoting metrics if stats is empty + // skip reporting metrics if stats is empty if self.is_empty() { return; } @@ -700,14 +700,11 @@ impl BankingStage { // `original_unprocessed_indexes` must have remaining packets to process // if not yet processed. - assert!(Self::packet_has_more_unprocessed_transactions( - &original_unprocessed_indexes - )); + assert!(!original_unprocessed_indexes.is_empty()); true } } }); - proc_start.stop(); debug!( @@ -2015,7 +2012,7 @@ impl BankingStage { banking_stage_stats: &mut BankingStageStats, slot_metrics_tracker: &mut LeaderSlotMetricsTracker, ) { - if Self::packet_has_more_unprocessed_transactions(&packet_indexes) { + if !packet_indexes.is_empty() { if unprocessed_packet_batches.len() >= batch_limit { *dropped_packet_batches_count += 1; if let Some(dropped_batch) = unprocessed_packet_batches.pop_front() { @@ -2041,10 +2038,6 @@ impl BankingStage { } } - fn packet_has_more_unprocessed_transactions(packet_indexes: &[usize]) -> bool { - !packet_indexes.is_empty() - } - pub fn join(self) -> thread::Result<()> { for bank_thread_hdl in self.bank_thread_hdls { bank_thread_hdl.join()?;