diff --git a/src/evo/cbtx.cpp b/src/evo/cbtx.cpp index ce7b484b59..5449fe7486 100644 --- a/src/evo/cbtx.cpp +++ b/src/evo/cbtx.cpp @@ -177,12 +177,12 @@ bool CalcCbTxMerkleRootQuorums(const CBlock& block, const CBlockIndex* pindexPre int64_t nTime2 = GetTimeMicros(); nTimeMinedAndActive += nTime2 - nTime1; LogPrint(BCLog::BENCHMARK, " - GetMinedAndActiveCommitmentsUntilBlock: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimeMinedAndActive * 0.000001); - static CCriticalSection cs_cache; - static std::map> quorums_cached GUARDED_BY(cs_cache); - static std::map> qcHashes_cached GUARDED_BY(cs_cache); - static std::map> qcIndexedHashes_cached GUARDED_BY(cs_cache); - { + static CCriticalSection cs_cache; + static std::map> quorums_cached GUARDED_BY(cs_cache); + static std::map> qcHashes_cached GUARDED_BY(cs_cache); + static std::map> qcIndexedHashes_cached GUARDED_BY(cs_cache); + LOCK(cs_cache); if (quorums == quorums_cached) {