From c14e0c62521952d55f1d98cd8dce45e96f0468a2 Mon Sep 17 00:00:00 2001 From: goshawk Date: Thu, 23 Nov 2023 11:21:58 +0200 Subject: [PATCH] consensus: Resolve unit-test failure --- consensus/src/aggregator.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/consensus/src/aggregator.rs b/consensus/src/aggregator.rs index 04c898cda0..4f0050fc65 100644 --- a/consensus/src/aggregator.rs +++ b/consensus/src/aggregator.rs @@ -291,10 +291,12 @@ mod tests { // Last member's vote should reach the quorum if i == winning_index { // (hash, sv) is only returned in case we reach the quorum - let (hash, sv) = a + let (hash, sv, quorum_reached) = a .collect_vote(&c, h, signature) .expect("failed to reach quorum"); + assert_eq!(quorum_reached, true, "quorum should be reached"); + // Check expected block hash assert_eq!(hash, block_hash); @@ -307,7 +309,14 @@ mod tests { } // Check collected votes - assert!(a.collect_vote(&c, h, signature).is_none()); + let (_, _, quorum_reached) = + a.collect_vote(&c, h, signature).unwrap(); + + assert_eq!( + quorum_reached, false, + "quorum should not be reached yet" + ); + collected_votes += expected_votes[i]; assert_eq!(a.get_total(h.step, block_hash), Some(collected_votes));