From 23567bce07cc30f66775490cfd119cd57c801b50 Mon Sep 17 00:00:00 2001 From: Satya Vusirikala Date: Fri, 14 Jun 2024 17:06:54 -0700 Subject: [PATCH] Fix a bug in pull proofs method --- consensus/src/quorum_store/utils.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/consensus/src/quorum_store/utils.rs b/consensus/src/quorum_store/utils.rs index 7ee291da35e6c..bc2cc951883c1 100644 --- a/consensus/src/quorum_store/utils.rs +++ b/consensus/src/quorum_store/utils.rs @@ -309,13 +309,15 @@ impl ProofQueue { } else if let Some(Some((proof, insertion_time))) = self.batch_to_proof.get(&sort_key.batch_key) { - cur_bytes += batch.num_bytes(); - cur_txns += batch.num_txns(); - if cur_bytes > max_bytes || cur_txns > max_txns { + if cur_bytes + batch.num_bytes() > max_bytes + || cur_txns + batch.num_txns() > max_txns + { // Exceeded the limit for requested bytes or number of transactions. full = true; return false; } + cur_bytes += batch.num_bytes(); + cur_txns += batch.num_txns(); let bucket = proof.gas_bucket_start(); ret.push(proof.clone()); counters::pos_to_pull(bucket, insertion_time.elapsed().as_secs_f64());