diff --git a/src/evo/deterministicmns.cpp b/src/evo/deterministicmns.cpp index 6f664c05a..a93965f1b 100644 --- a/src/evo/deterministicmns.cpp +++ b/src/evo/deterministicmns.cpp @@ -438,6 +438,13 @@ CDeterministicMNManager::CDeterministicMNManager(CEvoDB& _evoDb) : bool CDeterministicMNManager::ProcessBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& _state) { + AssertLockHeld(cs_main); + + bool fDIP0003Active = VersionBitsState(pindex->pprev, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0003, versionbitscache) == THRESHOLD_ACTIVE; + if (!fDIP0003Active) { + return true; + } + LOCK(cs); int nHeight = pindex->nHeight; @@ -457,7 +464,7 @@ bool CDeterministicMNManager::ProcessBlock(const CBlock& block, const CBlockInde CDeterministicMNListDiff diff = oldList.BuildDiff(newList); evoDb.Write(std::make_pair(DB_LIST_DIFF, diff.blockHash), diff); - if ((nHeight % SNAPSHOT_LIST_PERIOD) == 0) { + if ((nHeight % SNAPSHOT_LIST_PERIOD) == 0 || oldList.GetHeight() == -1) { evoDb.Write(std::make_pair(DB_LIST_SNAPSHOT, diff.blockHash), newList); LogPrintf("CDeterministicMNManager::%s -- Wrote snapshot. nHeight=%d, mapCurMNs.allMNsCount=%d\n", __func__, nHeight, newList.GetAllMNsCount());