From 780276497fbaf2970dbb50c81c07ad73cd69e30d Mon Sep 17 00:00:00 2001 From: danielsanchezq Date: Wed, 15 Mar 2023 10:02:29 +0100 Subject: [PATCH] Fix endless loop on mocktally --- nomos-core/src/vote/mock.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nomos-core/src/vote/mock.rs b/nomos-core/src/vote/mock.rs index 5a5d3b12..3491edf9 100644 --- a/nomos-core/src/vote/mock.rs +++ b/nomos-core/src/vote/mock.rs @@ -66,11 +66,10 @@ impl Tally for MockTally { return Err(Error("Invalid vote".into())); } count_votes += 1; + if count_votes > self.threshold { + return Ok(MockQc { count_votes }); + } } - if count_votes > self.threshold { - Ok(MockQc { count_votes }) - } else { - Err(Error("Not enough votes".into())) - } + Err(Error("Not enough votes".into())) } }