fix: adjust payee predictions after mn_rr activation

This commit is contained in:
UdjinM6 2024-08-20 01:36:00 +03:00
parent d8fca38404
commit 9d47cd2226
No known key found for this signature in database
GPG Key ID: 83592BD1400D58D9

View File

@ -215,7 +215,9 @@ std::vector<CDeterministicMNCPtr> 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<CDeterministicMNCPtr> result;
@ -223,7 +225,6 @@ std::vector<CDeterministicMNCPtr> 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<CDeterministicMNCPtr> 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);
}
});