From 10c529224c75b66da940d1fd90711f86f2d90667 Mon Sep 17 00:00:00 2001 From: Dulana Peiris Date: Tue, 29 Apr 2025 16:38:56 +0530 Subject: [PATCH] Consensus bugfix --- src/consensus.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/consensus.cpp b/src/consensus.cpp index 4efb7ee2..65cd3071 100644 --- a/src/consensus.cpp +++ b/src/consensus.cpp @@ -1077,7 +1077,8 @@ namespace consensus // Check whether we have received enough votes in total. // Threshold is devided by 100 to convert average to decimal. - const uint32_t min_votes_required = ceil((conf::cfg.contract.consensus.threshold / 100.0) * unl_count); + const float stage_threshold = ((STAGE_THRESHOLD_RATIO[ctx.stage - 1] * conf::cfg.contract.consensus.threshold) / (STAGE_THRESHOLD_RATIO[2] * 100.0)); + const uint32_t min_votes_required = ceil(stage_threshold * unl_count); if (total_ledger_primary_hash_votes < min_votes_required) { LOG_INFO << "Not enough peers proposing to perform consensus. votes:" << total_ledger_primary_hash_votes << " needed:" << min_votes_required;