From 8168aadc0a36d0cd926cf7f80df8961c202d8ec2 Mon Sep 17 00:00:00 2001 From: "Brian (Sunghoon) Cho" Date: Wed, 23 Aug 2023 15:00:15 -0700 Subject: [PATCH] [Quorum Store] remove redundant checks (#9673) ### Description remove handle_batch which does checks that ensure_max_limits already does --- .../src/quorum_store/batch_coordinator.rs | 34 +------------------ 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/consensus/src/quorum_store/batch_coordinator.rs b/consensus/src/quorum_store/batch_coordinator.rs index b8310e395eab0..8fdeb2687eece 100644 --- a/consensus/src/quorum_store/batch_coordinator.rs +++ b/consensus/src/quorum_store/batch_coordinator.rs @@ -52,36 +52,6 @@ impl BatchCoordinator { } } - async fn handle_batch(&mut self, batch: Batch) -> Option { - let author = batch.author(); - let batch_id = batch.batch_id(); - trace!( - "QS: got batch message from {} batch_id {}", - author, - batch_id, - ); - counters::RECEIVED_BATCH_COUNT.inc(); - if batch.num_txns() > self.max_batch_txns { - warn!( - "Batch from {} exceeds txn limit {}, actual txns: {}", - author, - self.max_batch_txns, - batch.num_txns(), - ); - return None; - } - if batch.num_bytes() > self.max_batch_bytes { - warn!( - "Batch from {} exceeds size limit {}, actual size: {}", - author, - self.max_batch_bytes, - batch.num_bytes(), - ); - return None; - } - Some(batch.into()) - } - fn persist_and_send_digests(&self, persist_requests: Vec) { if persist_requests.is_empty() { return; @@ -148,9 +118,7 @@ impl BatchCoordinator { let mut persist_requests = vec![]; for batch in batches.into_iter() { - if let Some(persist_request) = self.handle_batch(batch).await { - persist_requests.push(persist_request); - } + persist_requests.push(batch.into()); } self.persist_and_send_digests(persist_requests); }