From c5da226a0920fb89b38830c75fd8715dc5474333 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Sat, 21 Mar 2015 20:10:34 -0700 Subject: [PATCH] changed some locks --- src/darksend.cpp | 4 ++-- src/masternode.cpp | 6 +++--- src/masternodeman.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/darksend.cpp b/src/darksend.cpp index cc63168d3b..e9d9363f60 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -102,7 +102,7 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand } } else if (strCommand == "dsq") { //Darksend Queue - LOCK(cs_darksend); + TRY_LOCK(cs_darksend); if (pfrom->nVersion < MIN_POOL_PEER_PROTO_VERSION) { return; @@ -2508,7 +2508,6 @@ void CDarksendPool::RelayInAnon(std::vector& vin, std::vector& vo void CDarksendPool::RelayIn(const std::vector& vin, const int64_t& nAmount, const CTransaction& txCollateral, const std::vector& vout) { - LOCK(cs_vNodes); std::vector vin2; std::vector vout2; @@ -2519,6 +2518,7 @@ void CDarksendPool::RelayIn(const std::vector& vin, const int64_t& nAmo BOOST_FOREACH(CTxDSOut out, vout) vout2.push_back(out); + LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) { if(!pSubmittedToMasternode) return; diff --git a/src/masternode.cpp b/src/masternode.cpp index 2bd0397794..5cabe934a4 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -222,9 +222,9 @@ uint256 CMasternode::CalculateScore(int mod, int64_t nBlockHeight) void CMasternode::Check() { - LOCK(cs_main); + TRY_LOCK(cs_main); - if(nScanningErrorCount >= MASTERNODE_SCANNING_ERROR_THESHOLD) + if(nScanningErrorCount >= MASTERNODE_SCANNING_ERROR_THESHOLD) { activeState = MASTERNODE_POS_ERROR; return; @@ -396,7 +396,7 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight) if(!enabled) return false; CMasternodePaymentWinner newWinner; int nMinimumAge = mnodeman.CountEnabled(); - + uint256 hash; if(!GetBlockHash(hash, nBlockHeight-10)) return false; int nHash; diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index 261aa1686d..9f89dbe2b8 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -488,7 +488,7 @@ void CMasternodeMan::ProcessMasternodeConnections() LOCK(cs_vNodes); if(!darkSendPool.pSubmittedToMasternode) return; - + BOOST_FOREACH(CNode* pnode, vNodes) { if(darkSendPool.pSubmittedToMasternode->addr == pnode->addr) continue; @@ -557,7 +557,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData if(donationPercentage < 0 || donationPercentage > 100){ LogPrintf("dsee - donation percentage out of range %d\n", donationPercentage); - return; + return; } if(protocolVersion < nMasternodeMinProtocol) {