@@ -241,17 +241,6 @@ bool CMNPaymentsProcessor::IsBlockValueValid(const CBlock& block, const int nBlo
241241
242242 // we are synced and possibly on a superblock now
243243
244- if (!AreSuperblocksEnabled (m_sporkman)) {
245- // should NOT allow superblocks at all, when superblocks are disabled
246- // revert to block reward limits in this case
247- LogPrint (BCLog::GOBJECT, " CMNPaymentsProcessor::%s -- Superblocks are disabled, no superblocks allowed\n " , __func__);
248- if (!isBlockRewardValueMet) {
249- strErrorRet = strprintf (" coinbase pays too much at height %d (actual=%d vs limit=%d), exceeded block reward, superblocks are disabled" ,
250- nBlockHeight, block.vtx [0 ]->GetValueOut (), blockReward);
251- }
252- return isBlockRewardValueMet;
253- }
254-
255244 if (!check_superblock) return true ;
256245
257246 const auto tip_mn_list = m_dmnman.GetListAtChainTip ();
@@ -308,26 +297,23 @@ bool CMNPaymentsProcessor::IsBlockPayeeValid(const CTransaction& txNew, const CB
308297 }
309298
310299 // superblocks started
300+ if (!check_superblock) return true ;
311301
312- if (AreSuperblocksEnabled (m_sporkman)) {
313- if (!check_superblock) return true ;
314- const auto tip_mn_list = m_dmnman.GetListAtChainTip ();
315- if (m_govman.IsSuperblockTriggered (tip_mn_list, nBlockHeight)) {
316- if (m_govman.IsValidSuperblock (m_chainman.ActiveChain (), tip_mn_list, txNew, nBlockHeight,
317- blockSubsidy + feeReward)) {
318- LogPrint (BCLog::GOBJECT, " CMNPaymentsProcessor::%s -- Valid superblock at height %d: %s" , __func__, nBlockHeight, txNew.ToString ()); /* Continued */
319- // continue validation, should also pay MN
320- } else {
321- LogPrintf (" CMNPaymentsProcessor::%s -- ERROR! Invalid superblock detected at height %d: %s" , __func__, nBlockHeight, txNew.ToString ()); /* Continued */
322- // should NOT allow such superblocks, when superblocks are enabled
323- return false ;
324- }
302+ const auto tip_mn_list = m_dmnman.GetListAtChainTip ();
303+ if (m_govman.IsSuperblockTriggered (tip_mn_list, nBlockHeight)) {
304+ if (m_govman.IsValidSuperblock (m_chainman.ActiveChain (), tip_mn_list, txNew, nBlockHeight,
305+ blockSubsidy + feeReward)) {
306+ LogPrint (BCLog::GOBJECT, " CMNPaymentsProcessor::%s -- Valid superblock at height %d: %s" , /* Continued */
307+ __func__, nBlockHeight, txNew.ToString ());
308+ // continue validation, should also pay MN
325309 } else {
326- LogPrint (BCLog::GOBJECT, " CMNPaymentsProcessor::%s -- No triggered superblock detected at height %d\n " , __func__, nBlockHeight);
310+ LogPrintf (" CMNPaymentsProcessor::%s -- ERROR! Invalid superblock detected at height %d: %s" , /* Continued */
311+ __func__, nBlockHeight, txNew.ToString ());
312+ return false ;
327313 }
328314 } else {
329- // should NOT allow superblocks at all, when superblocks are disabled
330- LogPrint (BCLog::GOBJECT, " CMNPaymentsProcessor::%s -- Superblocks are disabled, no superblocks allowed \n " , __func__);
315+ LogPrint (BCLog::GOBJECT, " CMNPaymentsProcessor::%s -- No triggered superblock detected at height %d \n " ,
316+ __func__, nBlockHeight );
331317 }
332318
333319 return true ;
@@ -338,10 +324,9 @@ void CMNPaymentsProcessor::FillBlockPayments(CMutableTransaction& txNew, const C
338324{
339325 int nBlockHeight = pindexPrev == nullptr ? 0 : pindexPrev->nHeight + 1 ;
340326
341- // only create superblocks if spork is enabled AND if superblock is actually triggered
342- // (height should be validated inside)
327+ // Only create superblocks when one is actually triggered.
343328 const auto tip_mn_list = m_dmnman.GetListAtChainTip ();
344- if (AreSuperblocksEnabled (m_sporkman) && m_govman.IsSuperblockTriggered (tip_mn_list, nBlockHeight)) {
329+ if (m_govman.IsSuperblockTriggered (tip_mn_list, nBlockHeight)) {
345330 LogPrint (BCLog::GOBJECT, " CMNPaymentsProcessor::%s -- Triggered superblock creation at height %d\n " , __func__, nBlockHeight);
346331 m_govman.GetSuperblockPayments (tip_mn_list, nBlockHeight, voutSuperblockPaymentsRet);
347332 }
0 commit comments