@@ -182,10 +182,10 @@ CDeterministicMNCPtr CDeterministicMNList::GetMNPayee(const CBlockIndex* pIndex)
182182 }
183183
184184 bool isv19Active = llmq::utils::IsV19Active (pIndex);
185+ bool isv20Active = llmq::utils::IsV20Active (pIndex);
185186 // Starting from v19 and until v20 (Platform release), HPMN will be rewarded 4 blocks in a row
186- // TODO: Skip this code once v20 is active
187187 CDeterministicMNCPtr best = nullptr ;
188- if (isv19Active) {
188+ if (isv19Active && !isv20Active ) {
189189 ForEachMNShared (true , [&](const CDeterministicMNCPtr& dmn) {
190190 if (dmn->pdmnState ->nLastPaidHeight == nHeight) {
191191 // We found the last MN Payee.
@@ -211,7 +211,12 @@ CDeterministicMNCPtr CDeterministicMNList::GetMNPayee(const CBlockIndex* pIndex)
211211 return best;
212212}
213213
214- std::vector<CDeterministicMNCPtr> CDeterministicMNList::GetProjectedMNPayees (int nCount) const
214+ std::vector<CDeterministicMNCPtr> CDeterministicMNList::GetProjectedMNPayeesAtChainTip (int nCount) const
215+ {
216+ return GetProjectedMNPayees (::ChainActive ()[nHeight], nCount);
217+ }
218+
219+ std::vector<CDeterministicMNCPtr> CDeterministicMNList::GetProjectedMNPayees (const CBlockIndex* const pindex, int nCount) const
215220{
216221 if (nCount < 0 ) {
217222 return {};
@@ -223,11 +228,12 @@ std::vector<CDeterministicMNCPtr> CDeterministicMNList::GetProjectedMNPayees(int
223228
224229 auto remaining_hpmn_payments = 0 ;
225230 CDeterministicMNCPtr hpmn_to_be_skipped = nullptr ;
231+ bool isV20Active = llmq::utils::IsV20Active (pindex);
226232 ForEachMNShared (true , [&](const CDeterministicMNCPtr& dmn) {
227233 if (dmn->pdmnState ->nLastPaidHeight == nHeight) {
228234 // We found the last MN Payee.
229235 // If the last payee is a HPMN, we need to check its consecutive payments and pay him again if needed
230- if (dmn->nType == MnType::HighPerformance && dmn->pdmnState ->nConsecutivePayments < dmn_types::HighPerformance.voting_weight ) {
236+ if (!isV20Active && dmn->nType == MnType::HighPerformance && dmn->pdmnState ->nConsecutivePayments < dmn_types::HighPerformance.voting_weight ) {
231237 remaining_hpmn_payments = dmn_types::HighPerformance.voting_weight - dmn->pdmnState ->nConsecutivePayments ;
232238 for ([[maybe_unused]] auto _ : irange::range (remaining_hpmn_payments)) {
233239 result.emplace_back (dmn);
@@ -720,6 +726,8 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, const C
720726
721727 DecreasePoSePenalties (newList);
722728
729+ bool isv20Active = llmq::utils::IsV20Active (pindexPrev);
730+
723731 // we skip the coinbase
724732 for (int i = 1 ; i < (int )block.vtx .size (); i++) {
725733 const CTransaction& tx = *block.vtx [i];
@@ -939,9 +947,8 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, const C
939947 newState->nLastPaidHeight = nHeight;
940948 // Starting from v19 and until v20, HPMN will be paid 4 blocks in a row
941949 // No need to check if v19 is active, since HPMN ProRegTx are allowed only after v19 activation
942- // TODO: Skip this code once v20 is active
943950 // Note: If the payee wasn't found in the current block that's fine
944- if (dmn->nType == MnType::HighPerformance) {
951+ if (dmn->nType == MnType::HighPerformance && !isv20Active ) {
945952 ++newState->nConsecutivePayments ;
946953 if (debugLogs) {
947954 LogPrint (BCLog::MNPAYMENTS, " CDeterministicMNManager::%s -- MN %s is a HPMN, bumping nConsecutivePayments to %d\n " ,
@@ -959,8 +966,8 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, const C
959966 // reset nConsecutivePayments on non-paid HPMNs
960967 auto newList2 = newList;
961968 newList2.ForEachMN (false , [&](auto & dmn) {
962- if (payee != nullptr && dmn.proTxHash == payee->proTxHash ) return ;
963969 if (dmn.nType != MnType::HighPerformance) return ;
970+ if (payee != nullptr && dmn.proTxHash == payee->proTxHash && !isv20Active) return ;
964971 if (dmn.pdmnState ->nConsecutivePayments == 0 ) return ;
965972 if (debugLogs) {
966973 LogPrint (BCLog::MNPAYMENTS, " CDeterministicMNManager::%s -- MN %s, reset nConsecutivePayments %d->0\n " ,
0 commit comments