Skip to content

Commit

Permalink
[Quorum Store] remove redundant checks (#9673)
Browse files Browse the repository at this point in the history
### Description

remove handle_batch which does checks that ensure_max_limits already does
  • Loading branch information
bchocho authored Aug 23, 2023
1 parent 0506416 commit 8168aad
Showing 1 changed file with 1 addition and 33 deletions.
34 changes: 1 addition & 33 deletions consensus/src/quorum_store/batch_coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,36 +52,6 @@ impl BatchCoordinator {
}
}

async fn handle_batch(&mut self, batch: Batch) -> Option<PersistedValue> {
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<PersistedValue>) {
if persist_requests.is_empty() {
return;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 8168aad

Please sign in to comment.