fix deadlock on sync (#1104)
This commit is contained in:
parent
ce8e81d752
commit
d9d6d4f6eb
@ -210,8 +210,7 @@ void CMasternodeSync::ProcessTick()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRY_LOCK(cs_vNodes, lockRecv);
|
LOCK2(mnodeman.cs, cs_vNodes);
|
||||||
if(!lockRecv) return;
|
|
||||||
|
|
||||||
if(nRequestedMasternodeAssets == MASTERNODE_SYNC_INITIAL ||
|
if(nRequestedMasternodeAssets == MASTERNODE_SYNC_INITIAL ||
|
||||||
(nRequestedMasternodeAssets == MASTERNODE_SYNC_SPORKS && IsBlockchainSynced()))
|
(nRequestedMasternodeAssets == MASTERNODE_SYNC_SPORKS && IsBlockchainSynced()))
|
||||||
|
@ -608,8 +608,6 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
|
|||||||
if(fLiteMode) return; // disable all Dash specific functionality
|
if(fLiteMode) return; // disable all Dash specific functionality
|
||||||
if(!masternodeSync.IsBlockchainSynced()) return;
|
if(!masternodeSync.IsBlockchainSynced()) return;
|
||||||
|
|
||||||
LOCK(cs);
|
|
||||||
|
|
||||||
if (strCommand == NetMsgType::MNANNOUNCE) { //Masternode Broadcast
|
if (strCommand == NetMsgType::MNANNOUNCE) { //Masternode Broadcast
|
||||||
|
|
||||||
CMasternodeBroadcast mnb;
|
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());
|
LogPrint("masternode", "MNPING -- Masternode ping, masternode=%s\n", mnp.vin.prevout.ToStringShort());
|
||||||
|
|
||||||
|
LOCK(cs);
|
||||||
|
|
||||||
if(mapSeenMasternodePing.count(mnp.GetHash())) return; //seen
|
if(mapSeenMasternodePing.count(mnp.GetHash())) return; //seen
|
||||||
mapSeenMasternodePing.insert(std::make_pair(mnp.GetHash(), mnp));
|
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());
|
LogPrint("masternode", "DSEG -- Masternode list, masternode=%s\n", vin.prevout.ToStringShort());
|
||||||
|
|
||||||
|
LOCK(cs);
|
||||||
|
|
||||||
if(vin == CTxIn()) { //only should ask for this once
|
if(vin == CTxIn()) { //only should ask for this once
|
||||||
//local network
|
//local network
|
||||||
bool isLocal = (pfrom->addr.IsRFC1918() || pfrom->addr.IsLocal());
|
bool isLocal = (pfrom->addr.IsRFC1918() || pfrom->addr.IsLocal());
|
||||||
|
@ -49,6 +49,8 @@ private:
|
|||||||
|
|
||||||
int64_t nLastWatchdogVoteTime;
|
int64_t nLastWatchdogVoteTime;
|
||||||
|
|
||||||
|
friend class CMasternodeSync;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Keep track of all broadcasts I've seen
|
// Keep track of all broadcasts I've seen
|
||||||
std::map<uint256, CMasternodeBroadcast> mapSeenMasternodeBroadcast;
|
std::map<uint256, CMasternodeBroadcast> mapSeenMasternodeBroadcast;
|
||||||
|
Loading…
Reference in New Issue
Block a user