diff --git a/src/evo/deterministicmns.cpp b/src/evo/deterministicmns.cpp index 3d7f26330b4af..35281e037088b 100644 --- a/src/evo/deterministicmns.cpp +++ b/src/evo/deterministicmns.cpp @@ -444,7 +444,7 @@ CDeterministicMNManager::CDeterministicMNManager(CEvoDB& _evoDb) : { } -bool CDeterministicMNManager::ProcessBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& _state) +bool CDeterministicMNManager::ProcessBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& _state, bool fJustCheck) { CDeterministicMNList oldList, newList; CDeterministicMNListDiff diff; @@ -458,6 +458,10 @@ bool CDeterministicMNManager::ProcessBlock(const CBlock& block, const CBlockInde return false; } + if (fJustCheck) { + return true; + } + if (newList.GetHeight() == -1) { newList.SetHeight(nHeight); } diff --git a/src/evo/deterministicmns.h b/src/evo/deterministicmns.h index 7d05f179a05f2..43461eb8f7edd 100644 --- a/src/evo/deterministicmns.h +++ b/src/evo/deterministicmns.h @@ -479,7 +479,7 @@ class CDeterministicMNManager public: CDeterministicMNManager(CEvoDB& _evoDb); - bool ProcessBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& state); + bool ProcessBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& state, bool fJustCheck); bool UndoBlock(const CBlock& block, const CBlockIndex* pindex); void UpdatedBlockTip(const CBlockIndex* pindex); diff --git a/src/evo/specialtx.cpp b/src/evo/specialtx.cpp index 9e916bb45698f..7bd3ad8c13820 100644 --- a/src/evo/specialtx.cpp +++ b/src/evo/specialtx.cpp @@ -86,7 +86,7 @@ bool UndoSpecialTx(const CTransaction& tx, const CBlockIndex* pindex) return false; } -bool ProcessSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& state) +bool ProcessSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& state, bool fJustCheck) { for (int i = 0; i < (int)block.vtx.size(); i++) { const CTransaction& tx = *block.vtx[i]; @@ -102,7 +102,7 @@ bool ProcessSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex, CV return false; } - if (!deterministicMNManager->ProcessBlock(block, pindex, state)) { + if (!deterministicMNManager->ProcessBlock(block, pindex, state, fJustCheck)) { return false; } diff --git a/src/evo/specialtx.h b/src/evo/specialtx.h index 9eb49ea020177..151b67141082c 100644 --- a/src/evo/specialtx.h +++ b/src/evo/specialtx.h @@ -14,7 +14,7 @@ class CBlockIndex; class CValidationState; bool CheckSpecialTx(const CTransaction& tx, const CBlockIndex* pindexPrev, CValidationState& state); -bool ProcessSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& state); +bool ProcessSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& state, bool fJustCheck); bool UndoSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex); template diff --git a/src/validation.cpp b/src/validation.cpp index ae2d2e67b1d66..7abc06fa2b8ea 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2184,10 +2184,6 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd int64_t nTime4 = GetTimeMicros(); nTimeVerify += nTime4 - nTime2; LogPrint("bench", " - Verify %u txins: %.2fms (%.3fms/txin) [%.2fs]\n", nInputs - 1, 0.001 * (nTime4 - nTime2), nInputs <= 1 ? 0 : 0.001 * (nTime4 - nTime2) / (nInputs-1), nTimeVerify * 0.000001); - if (!ProcessSpecialTxsInBlock(block, pindex, state)) { - return error("ConnectBlock(): ProcessSpecialTxsInBlock for block %s failed with %s", - pindex->GetBlockHash().ToString(), FormatStateMessage(state)); - } // DASH : MODIFIED TO CHECK MASTERNODE PAYMENTS AND SUPERBLOCKS @@ -2208,6 +2204,12 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd return state.DoS(0, error("ConnectBlock(DASH): couldn't find masternode or superblock payments"), REJECT_INVALID, "bad-cb-payee"); } + + if (!ProcessSpecialTxsInBlock(block, pindex, state, fJustCheck)) { + return error("ConnectBlock(DASH): ProcessSpecialTxsInBlock for block %s failed with %s", + pindex->GetBlockHash().ToString(), FormatStateMessage(state)); + } + int64_t nTime5 = GetTimeMicros(); nTimeVerify += nTime5 - nTime4; LogPrint("bench", " - Payee and special txes: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime2), nTimeVerify * 0.000001);