mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Move cs_main lock from CMasternode::UpdateLastPaid to CMasternodeMan
Ensure correct locking order to fix deadlock.
This commit is contained in:
parent
dc7292afa9
commit
19fbf8ab76
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user