Skip to content

Commit

Permalink
fix: adjust payee predictions after mn_rr activation
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 committed Aug 20, 2024
1 parent d8fca38 commit 9d47cd2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/evo/deterministicmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,16 @@ 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;
result.reserve(weighted_count);

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) {
Expand All @@ -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);
}
});
Expand Down

0 comments on commit 9d47cd2

Please sign in to comment.