Skip to content

Commit

Permalink
use subtracting sub
Browse files Browse the repository at this point in the history
  • Loading branch information
bchocho committed Jan 9, 2025
1 parent 6c50309 commit a060983
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions consensus/src/quorum_store/batch_proof_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,13 @@ impl BatchProofQueue {

#[inline]
fn dec_unordered_proofs(&mut self, author: &PeerId, num_txns: u64) {
self.remaining_txns_with_duplicates -= num_txns;
self.remaining_proofs -= 1;
// TODO: figure out why sometimes there are overflows, and if that's expected
self.remaining_txns_with_duplicates =
self.remaining_txns_with_duplicates.saturating_sub(num_txns);
self.remaining_proofs = self.remaining_proofs.saturating_sub(1);
if *author == self.my_peer_id {
self.remaining_local_txns -= num_txns;
self.remaining_local_proofs -= 1;
self.remaining_local_txns = self.remaining_local_txns.saturating_sub(num_txns);
self.remaining_local_proofs = self.remaining_local_proofs.saturating_sub(1);
}
}

Expand Down

0 comments on commit a060983

Please sign in to comment.