fix deadlock on sync (#1104)

This commit is contained in:
UdjinM6 2016-10-30 23:40:30 +04:00 committed by GitHub
parent ce8e81d752
commit d9d6d4f6eb
3 changed files with 7 additions and 4 deletions

View File

@ -210,8 +210,7 @@ void CMasternodeSync::ProcessTick()
return;
}
TRY_LOCK(cs_vNodes, lockRecv);
if(!lockRecv) return;
LOCK2(mnodeman.cs, cs_vNodes);
if(nRequestedMasternodeAssets == MASTERNODE_SYNC_INITIAL ||
(nRequestedMasternodeAssets == MASTERNODE_SYNC_SPORKS && IsBlockchainSynced()))

View File

@ -608,8 +608,6 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
if(fLiteMode) return; // disable all Dash specific functionality
if(!masternodeSync.IsBlockchainSynced()) return;
LOCK(cs);
if (strCommand == NetMsgType::MNANNOUNCE) { //Masternode Broadcast
CMasternodeBroadcast mnb;
@ -634,6 +632,8 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
LogPrint("masternode", "MNPING -- Masternode ping, masternode=%s\n", mnp.vin.prevout.ToStringShort());
LOCK(cs);
if(mapSeenMasternodePing.count(mnp.GetHash())) return; //seen
mapSeenMasternodePing.insert(std::make_pair(mnp.GetHash(), mnp));
@ -668,6 +668,8 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
LogPrint("masternode", "DSEG -- Masternode list, masternode=%s\n", vin.prevout.ToStringShort());
LOCK(cs);
if(vin == CTxIn()) { //only should ask for this once
//local network
bool isLocal = (pfrom->addr.IsRFC1918() || pfrom->addr.IsLocal());

View File

@ -49,6 +49,8 @@ private:
int64_t nLastWatchdogVoteTime;
friend class CMasternodeSync;
public:
// Keep track of all broadcasts I've seen
std::map<uint256, CMasternodeBroadcast> mapSeenMasternodeBroadcast;