diff --git a/src/dynafed.cpp b/src/dynafed.cpp index 29a20294837..e4564c84b1f 100644 --- a/src/dynafed.cpp +++ b/src/dynafed.cpp @@ -11,6 +11,7 @@ bool NextBlockIsParameterTransition(const CBlockIndex* pindexPrev, const Consens winning_entry.SetNull(); return false; } + LOCK(cs_main); std::map vote_tally; assert(next_height >= consensus.dynamic_epoch_length); for (int32_t height = next_height - 1; height >= (int32_t)(next_height - consensus.dynamic_epoch_length); --height) { @@ -62,6 +63,7 @@ DynaFedParamEntry ComputeNextBlockFullCurrentParameters(const CBlockIndex* pinde // may be pre-dynafed params const CBlockIndex* p_epoch_start = pindexPrev->GetAncestor(epoch_start_height); assert(p_epoch_start); + LOCK(cs_main); ForceUntrimHeader(p_epoch_start); if (p_epoch_start->dynafed_params().IsNull()) { // We need to construct the "full" current parameters of pre-dynafed @@ -96,6 +98,7 @@ DynaFedParamEntry ComputeNextBlockCurrentParameters(const CBlockIndex* pindexPre { assert(pindexPrev); + LOCK(cs_main); ForceUntrimHeader(pindexPrev); DynaFedParamEntry entry = ComputeNextBlockFullCurrentParameters(pindexPrev, consensus); diff --git a/src/pegins.cpp b/src/pegins.cpp index da47025d438..9146d2da509 100644 --- a/src/pegins.cpp +++ b/src/pegins.cpp @@ -475,6 +475,7 @@ std::vector> GetValidFedpegScripts(const CBlockIndex fedpegscripts.push_back(std::make_pair(next_param.m_fedpeg_program, next_param.m_fedpegscript)); } + LOCK(cs_main); // Next we walk backwards up to M epoch starts for (int32_t i = 0; i < (int32_t) params.total_valid_epochs; i++) { // We are within total_valid_epochs of the genesis diff --git a/src/validation.cpp b/src/validation.cpp index 749c0f98a5c..21508ab7b8f 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2510,6 +2510,7 @@ void CChainState::UpdateTip(const CBlockIndex* pindexNew) this->CoinsTip().DynamicMemoryUsage() * (1.0 / (1<<20)), this->CoinsTip().GetCacheSize(), !warning_messages.empty() ? strprintf(" warning='%s'", warning_messages.original) : ""); + LOCK(cs_main); ForceUntrimHeader(pindexNew); // Do some logging if dynafed parameters changed. if (pindexNew->pprev && !pindexNew->dynafed_params().IsNull()) {