Skip to content

Commit

Permalink
fix possible masternode deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
uhliksk committed May 1, 2019
1 parent 25f3887 commit 65101fb
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/masternodeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ bool CMasternodeMan::PoSeBan(const COutPoint &outpoint)

void CMasternodeMan::Check()
{
LOCK(cs);
// FXTC BEGIN
//LOCK(cs);
LOCK2(cs_main, cs);
// FXTC END

LogPrint(BCLog::MASTERNODE, "CMasternodeMan::Check -- nLastWatchdogVoteTime=%d, IsWatchdogActive()=%d\n", nLastWatchdogVoteTime, IsWatchdogActive());

Expand Down Expand Up @@ -1452,7 +1455,10 @@ bool CMasternodeMan::CheckMnbAndUpdateMasternodeList(CNode* pfrom, CMasternodeBr

void CMasternodeMan::UpdateLastPaid(const CBlockIndex* pindex)
{
LOCK(cs);
// FXTC BEGIN
//LOCK(cs);
LOCK2(cs_main, cs);
// FXTC END

if(fLiteMode || !masternodeSync.IsWinnersListSynced() || mapMasternodes.empty()) return;

Expand Down Expand Up @@ -1510,7 +1516,10 @@ void CMasternodeMan::RemoveGovernanceObject(uint256 nGovernanceObjectHash)

void CMasternodeMan::CheckMasternode(const CPubKey& pubKeyMasternode, bool fForce)
{
LOCK(cs);
// FXTC BEGIN
//LOCK(cs)
LOCK2(cs_main, cs);
// FXTC END
for (auto& mnpair : mapMasternodes) {
if (mnpair.second.pubKeyMasternode == pubKeyMasternode) {
mnpair.second.Check(fForce);
Expand Down

0 comments on commit 65101fb

Please sign in to comment.