From 9d47cd222657d52d41d5b18e5449e4986c77e3e2 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Tue, 20 Aug 2024 01:36:00 +0300 Subject: [PATCH] fix: adjust payee predictions after mn_rr activation --- src/evo/deterministicmns.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/evo/deterministicmns.cpp b/src/evo/deterministicmns.cpp index b35dab60a9..b75c1403c2 100644 --- a/src/evo/deterministicmns.cpp +++ b/src/evo/deterministicmns.cpp @@ -215,7 +215,9 @@ std::vector CDeterministicMNList::GetProjectedMNPayees(gsl if (nCount < 0 ) { return {}; } - const auto weighted_count = GetValidWeightedMNsCount(); + const bool isMNRewardReallocation = DeploymentActiveAfter(pindexPrev, Params().GetConsensus(), + Consensus::DEPLOYMENT_MN_RR); + const auto weighted_count = isMNRewardReallocation ? GetValidMNsCount() : GetValidWeightedMNsCount(); nCount = std::min(nCount, int(weighted_count)); std::vector result; @@ -223,7 +225,6 @@ std::vector CDeterministicMNList::GetProjectedMNPayees(gsl int remaining_evo_payments{0}; CDeterministicMNCPtr evo_to_be_skipped{nullptr}; - const bool isMNRewardReallocation{DeploymentActiveAfter(pindexPrev, Params().GetConsensus(), Consensus::DEPLOYMENT_MN_RR)}; if (!isMNRewardReallocation) { ForEachMNShared(true, [&](const CDeterministicMNCPtr& dmn) { if (dmn->pdmnState->nLastPaidHeight == nHeight) { @@ -242,7 +243,7 @@ std::vector CDeterministicMNList::GetProjectedMNPayees(gsl ForEachMNShared(true, [&](const CDeterministicMNCPtr& dmn) { if (dmn == evo_to_be_skipped) return; - for ([[maybe_unused]] auto _ : irange::range(GetMnType(dmn->nType).voting_weight)) { + for ([[maybe_unused]] auto _ : irange::range(isMNRewardReallocation ? 1 : GetMnType(dmn->nType).voting_weight)) { result.emplace_back(dmn); } });