From e0d6c5b5a2f5b9a2a323cb26328f42cf463788ae Mon Sep 17 00:00:00 2001 From: Ilya Savinov Date: Mon, 17 Jul 2017 16:59:04 +0300 Subject: [PATCH] fixed potential deadlock in CMasternodePing::SimpleCheck (#1534) --- src/masternode.cpp | 2 +- src/masternodeman.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/masternode.cpp b/src/masternode.cpp index 50c899c4b..803985772 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -821,7 +821,7 @@ bool CMasternodePing::SimpleCheck(int& nDos) } { - LOCK(cs_main); + AssertLockHeld(cs_main); BlockMap::iterator mi = mapBlockIndex.find(blockHash); if (mi == mapBlockIndex.end()) { LogPrint("masternode", "CMasternodePing::SimpleCheck -- Masternode ping is invalid, unknown block hash: masternode=%s blockHash=%s\n", vin.prevout.ToStringShort(), blockHash.ToString()); diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index 9d910df8d..7f3ad1480 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -1382,7 +1382,7 @@ std::string CMasternodeMan::ToString() const void CMasternodeMan::UpdateMasternodeList(CMasternodeBroadcast mnb) { - LOCK(cs); + LOCK2(cs_main, cs); mapSeenMasternodePing.insert(std::make_pair(mnb.lastPing.GetHash(), mnb.lastPing)); mapSeenMasternodeBroadcast.insert(std::make_pair(mnb.GetHash(), std::make_pair(GetTime(), mnb)));