diff --git a/src/masternode.cpp b/src/masternode.cpp index 39350741f..f8215e681 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -347,6 +347,8 @@ std::string CMasternode::GetStatus() const void CMasternode::UpdateLastPaid(const CBlockIndex *pindex, int nMaxBlocksToScanBack) { + AssertLockHeld(cs_main); + if(!pindex) return; if (deterministicMNManager->IsDeterministicMNsSporkActive(pindex->nHeight)) { @@ -354,7 +356,6 @@ void CMasternode::UpdateLastPaid(const CBlockIndex *pindex, int nMaxBlocksToScan if (!dmn || dmn->pdmnState->nLastPaidHeight == -1) { LogPrint("masternode", "CMasternode::UpdateLastPaidBlock -- searching for block with payment to %s -- not found\n", outpoint.ToStringShort()); } else { - LOCK(cs_main); nBlockLastPaid = (int)dmn->pdmnState->nLastPaidHeight; nTimeLastPaid = chainActive[nBlockLastPaid]->nTime; LogPrint("masternode", "CMasternode::UpdateLastPaidBlock -- searching for block with payment to %s -- found new %d\n", outpoint.ToStringShort(), nBlockLastPaid); diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index 318b45e1e..0be4cacee 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -1817,7 +1817,7 @@ bool CMasternodeMan::CheckMnbAndUpdateMasternodeList(CNode* pfrom, CMasternodeBr void CMasternodeMan::UpdateLastPaid(const CBlockIndex* pindex) { - LOCK(cs); + LOCK2(cs_main, cs); if(fLiteMode || !masternodeSync.IsWinnersListSynced() || mapMasternodes.empty()) return;