@@ -499,7 +499,7 @@ bool CSpecialTxProcessor::ProcessSpecialTxsInBlock(const CBlock& block, const CB
499499 static int64_t nTimeQuorum = 0 ;
500500 static int64_t nTimeDMN = 0 ;
501501 static int64_t nTimeMerkleMNL = 0 ;
502- static int64_t nTimeMerkle = 0 ;
502+ static int64_t nTimeMerkleQuorums = 0 ;
503503 static int64_t nTimeCbTxCL = 0 ;
504504 static int64_t nTimeMnehf = 0 ;
505505 static int64_t nTimePayload = 0 ;
@@ -606,12 +606,12 @@ bool CSpecialTxProcessor::ProcessSpecialTxsInBlock(const CBlock& block, const CB
606606 LogPrint (BCLog::BENCHMARK, " - m_dmnman: %.2fms [%.2fs]\n " , 0.001 * (nTime6 - nTime5), nTimeDMN * 0.000001 );
607607
608608 if (opt_cbTx.has_value ()) {
609- uint256 calculatedMerkleRoot ;
610- if (!CalcCbTxMerkleRootMNList (calculatedMerkleRoot , CSimplifiedMNList{std::move (mn_list)}, state)) {
609+ uint256 calculatedMerkleRootMNL ;
610+ if (!CalcCbTxMerkleRootMNList (calculatedMerkleRootMNL , CSimplifiedMNList{std::move (mn_list)}, state)) {
611611 // pass the state returned by the function above
612612 return false ;
613613 }
614- if (calculatedMerkleRoot != opt_cbTx->merkleRootMNList ) {
614+ if (calculatedMerkleRootMNL != opt_cbTx->merkleRootMNList ) {
615615 return state.Invalid (BlockValidationResult::BLOCK_CONSENSUS, " bad-cbtx-mnmerkleroot" );
616616 }
617617
@@ -620,16 +620,22 @@ bool CSpecialTxProcessor::ProcessSpecialTxsInBlock(const CBlock& block, const CB
620620 LogPrint (BCLog::BENCHMARK, " - CalcCbTxMerkleRootMNList: %.2fms [%.2fs]\n " ,
621621 0.001 * (nTime6_1 - nTime6), nTimeMerkleMNL * 0.000001 );
622622
623- if (!CheckCbTxMerkleRoots (block, *opt_cbTx, pindex, m_qblockman, state)) {
624- // pass the state returned by the function above
625- return false ;
623+ if (opt_cbTx->nVersion >= CCbTx::Version::MERKLE_ROOT_QUORUMS) {
624+ uint256 calculatedMerkleRootQuorums;
625+ if (!CalcCbTxMerkleRootQuorums (block, pindex->pprev , m_qblockman, calculatedMerkleRootQuorums, state)) {
626+ // pass the state returned by the function above
627+ return false ;
628+ }
629+ if (calculatedMerkleRootQuorums != opt_cbTx->merkleRootQuorums ) {
630+ return state.Invalid (BlockValidationResult::BLOCK_CONSENSUS, " bad-cbtx-quorummerkleroot" );
631+ }
626632 }
627633
628634 int64_t nTime6_2 = GetTimeMicros ();
629- nTimeMerkle += nTime6_2 - nTime6_1;
635+ nTimeMerkleQuorums += nTime6_2 - nTime6_1;
630636
631- LogPrint (BCLog::BENCHMARK, " - CheckCbTxMerkleRoots : %.2fms [%.2fs]\n " , 0.001 * (nTime6_2 - nTime6_1) ,
632- nTimeMerkle * 0.000001 );
637+ LogPrint (BCLog::BENCHMARK, " - CalcCbTxMerkleRootQuorums : %.2fms [%.2fs]\n " ,
638+ 0.001 * (nTime6_2 - nTime6_1), nTimeMerkleQuorums * 0.000001 );
633639
634640 if (!CheckCbTxBestChainlock (*opt_cbTx, pindex, m_clhandler, state)) {
635641 // pass the state returned by the function above
0 commit comments