From c5da226a0920fb89b38830c75fd8715dc5474333 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Sat, 21 Mar 2015 20:10:34 -0700 Subject: [PATCH 1/7] 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 cc63168d3..e9d9363f6 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 2bd039779..5cabe934a 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 261aa1686..9f89dbe2b 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) { From 988af26070d5193efeb217f4c90fc73138704036 Mon Sep 17 00:00:00 2001 From: snogcel Date: Sat, 21 Mar 2015 09:53:55 -0600 Subject: [PATCH 2/7] available balance font size, iX and darksend checkbox alignment --- src/qt/res/css/drkblue.css | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qt/res/css/drkblue.css b/src/qt/res/css/drkblue.css index d5bcd7439..76b04567b 100755 --- a/src/qt/res/css/drkblue.css +++ b/src/qt/res/css/drkblue.css @@ -704,8 +704,7 @@ min-height:35px; QWidget .QFrame#frame .QLabel#labelBalance { /* Available Balance */ qproperty-alignment: 'AlignVCenter | AlignLeft'; -margin-left:0px; -font-size:18px; +font-size:17px; font-weight:bold; color:#56ABD8; margin-left:13px; @@ -1050,7 +1049,7 @@ font-weight:bold; background: qradialgradient(cx:0.5, cy:0.5, radius: 0.5, fx:0.5, fy:0.5, stop:0 rgba(248, 246, 246, 128), stop: 1 rgba(0, 0, 0, 0)); border-radius:5px; padding-top:20px; -padding-bottom:20px; +padding-bottom:18px; } QDialog#SendCoinsDialog .QCheckBox#checkInstantX { /* InstantX Checkbox */ @@ -1059,7 +1058,7 @@ font-weight:bold; background: qradialgradient(cx:0.5, cy:0.5, radius: 0.5, fx:0.5, fy:0.5, stop:0 rgba(248, 246, 246, 128), stop: 1 rgba(0, 0, 0, 0)); border-radius:5px; padding-top:20px; -padding-bottom:20px; +padding-bottom:18px; margin-left:10px; margin-right:20px; } From bff51d4fcc73d719b499e5998c4e4867d8052109 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sun, 22 Mar 2015 02:49:57 +0300 Subject: [PATCH 3/7] disable relay --- src/darksend.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/darksend.cpp b/src/darksend.cpp index e9d9363f6..ad30ac3d3 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -645,6 +645,7 @@ void CDarksendPool::SetNull(bool clearEverything){ } //automatically downgrade for 11.2, blinding will be supported in 11.3/12.0 + nTrickleInputsOutputs = INT_MAX; Downgrade(); // -- seed random number generator (used for ordering output lists) From 00023e97dbb384cd4f22706d53a32c6ab31a518a Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sun, 22 Mar 2015 02:56:42 +0300 Subject: [PATCH 4/7] disconnect ds timer if not in litemode --- src/qt/overviewpage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 93f826514..eb664e7ca 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -160,7 +160,7 @@ void OverviewPage::handleTransactionClicked(const QModelIndex &index) OverviewPage::~OverviewPage() { - disconnect(timer, SIGNAL(timeout()), this, SLOT(darkSendStatus())); + if(!fLiteMode) disconnect(timer, SIGNAL(timeout()), this, SLOT(darkSendStatus())); delete ui; } From 66d96acd19a811363b463b6c7a079657fac54391 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sun, 22 Mar 2015 02:58:18 +0300 Subject: [PATCH 5/7] format only: tabs -> spaces --- src/activemasternode.cpp | 166 +++++++++++++++++++-------------------- 1 file changed, 83 insertions(+), 83 deletions(-) diff --git a/src/activemasternode.cpp b/src/activemasternode.cpp index c37fac082..c572a4b4b 100644 --- a/src/activemasternode.cpp +++ b/src/activemasternode.cpp @@ -37,7 +37,7 @@ void CActiveMasternode::ManageStatus() return; } } else { - service = CService(strMasterNodeAddr); + service = CService(strMasterNodeAddr); } LogPrintf("CActiveMasternode::ManageStatus() - Checking inbound connection to '%s'\n", service.ToString().c_str()); @@ -101,8 +101,8 @@ void CActiveMasternode::ManageStatus() if(!darkSendSigner.SetKey(strMasterNodePrivKey, errorMessage, keyMasternode, pubKeyMasternode)) { - LogPrintf("Register::ManageStatus() - Error upon calling SetKey: %s\n", errorMessage.c_str()); - return; + LogPrintf("Register::ManageStatus() - Error upon calling SetKey: %s\n", errorMessage.c_str()); + return; } /* donations are not supported in dash.conf */ @@ -128,63 +128,63 @@ void CActiveMasternode::ManageStatus() // Send stop dseep to network for remote Masternode bool CActiveMasternode::StopMasterNode(std::string strService, std::string strKeyMasternode, std::string& errorMessage) { - CTxIn vin; + CTxIn vin; CKey keyMasternode; CPubKey pubKeyMasternode; if(!darkSendSigner.SetKey(strKeyMasternode, errorMessage, keyMasternode, pubKeyMasternode)) { - LogPrintf("CActiveMasternode::StopMasterNode() - Error: %s\n", errorMessage.c_str()); - return false; - } + LogPrintf("CActiveMasternode::StopMasterNode() - Error: %s\n", errorMessage.c_str()); + return false; + } - return StopMasterNode(vin, CService(strService), keyMasternode, pubKeyMasternode, errorMessage); + return StopMasterNode(vin, CService(strService), keyMasternode, pubKeyMasternode, errorMessage); } // Send stop dseep to network for main Masternode bool CActiveMasternode::StopMasterNode(std::string& errorMessage) { - if(status != MASTERNODE_IS_CAPABLE && status != MASTERNODE_REMOTELY_ENABLED) { - errorMessage = "Masternode is not in a running status"; - LogPrintf("CActiveMasternode::StopMasterNode() - Error: %s\n", errorMessage.c_str()); - return false; - } + if(status != MASTERNODE_IS_CAPABLE && status != MASTERNODE_REMOTELY_ENABLED) { + errorMessage = "Masternode is not in a running status"; + LogPrintf("CActiveMasternode::StopMasterNode() - Error: %s\n", errorMessage.c_str()); + return false; + } - status = MASTERNODE_STOPPED; + status = MASTERNODE_STOPPED; CPubKey pubKeyMasternode; CKey keyMasternode; if(!darkSendSigner.SetKey(strMasterNodePrivKey, errorMessage, keyMasternode, pubKeyMasternode)) { - LogPrintf("Register::ManageStatus() - Error upon calling SetKey: %s\n", errorMessage.c_str()); - return false; + LogPrintf("Register::ManageStatus() - Error upon calling SetKey: %s\n", errorMessage.c_str()); + return false; } - return StopMasterNode(vin, service, keyMasternode, pubKeyMasternode, errorMessage); + return StopMasterNode(vin, service, keyMasternode, pubKeyMasternode, errorMessage); } // Send stop dseep to network for any Masternode bool CActiveMasternode::StopMasterNode(CTxIn vin, CService service, CKey keyMasternode, CPubKey pubKeyMasternode, std::string& errorMessage) { - pwalletMain->UnlockCoin(vin.prevout); - return Dseep(vin, service, keyMasternode, pubKeyMasternode, errorMessage, true); + pwalletMain->UnlockCoin(vin.prevout); + return Dseep(vin, service, keyMasternode, pubKeyMasternode, errorMessage, true); } bool CActiveMasternode::Dseep(std::string& errorMessage) { - if(status != MASTERNODE_IS_CAPABLE && status != MASTERNODE_REMOTELY_ENABLED) { - errorMessage = "Masternode is not in a running status"; - LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", errorMessage.c_str()); - return false; - } + if(status != MASTERNODE_IS_CAPABLE && status != MASTERNODE_REMOTELY_ENABLED) { + errorMessage = "Masternode is not in a running status"; + LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", errorMessage.c_str()); + return false; + } CPubKey pubKeyMasternode; CKey keyMasternode; if(!darkSendSigner.SetKey(strMasterNodePrivKey, errorMessage, keyMasternode, pubKeyMasternode)) { - LogPrintf("Register::ManageStatus() - Error upon calling SetKey: %s\n", errorMessage.c_str()); - return false; + LogPrintf("CActiveMasternode::Dseep() - Error upon calling SetKey: %s\n", errorMessage.c_str()); + return false; } - return Dseep(vin, service, keyMasternode, pubKeyMasternode, errorMessage, false); + return Dseep(vin, service, keyMasternode, pubKeyMasternode, errorMessage, false); } bool CActiveMasternode::Dseep(CTxIn vin, CService service, CKey keyMasternode, CPubKey pubKeyMasternode, std::string &retErrorMessage, bool stop) { @@ -196,14 +196,14 @@ bool CActiveMasternode::Dseep(CTxIn vin, CService service, CKey keyMasternode, C std::string strMessage = service.ToString() + boost::lexical_cast(masterNodeSignatureTime) + boost::lexical_cast(stop); if(!darkSendSigner.SignMessage(strMessage, errorMessage, vchMasterNodeSignature, keyMasternode)) { - retErrorMessage = "sign message failed: " + errorMessage; - LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", retErrorMessage.c_str()); + retErrorMessage = "sign message failed: " + errorMessage; + LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", retErrorMessage.c_str()); return false; } if(!darkSendSigner.VerifyMessage(pubKeyMasternode, vchMasterNodeSignature, strMessage, errorMessage)) { - retErrorMessage = "Verify message failed: " + errorMessage; - LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", retErrorMessage.c_str()); + retErrorMessage = "Verify message failed: " + errorMessage; + LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", retErrorMessage.c_str()); return false; } @@ -215,9 +215,9 @@ bool CActiveMasternode::Dseep(CTxIn vin, CService service, CKey keyMasternode, C } else { - // Seems like we are trying to send a ping while the Masternode is not registered in the network - retErrorMessage = "Darksend Masternode List doesn't include our Masternode, Shutting down Masternode pinging service! " + vin.ToString(); - LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", retErrorMessage.c_str()); + // Seems like we are trying to send a ping while the Masternode is not registered in the network + retErrorMessage = "Darksend Masternode List doesn't include our Masternode, Shutting down Masternode pinging service! " + vin.ToString(); + LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", retErrorMessage.c_str()); status = MASTERNODE_NOT_CAPABLE; notCapableReason = retErrorMessage; return false; @@ -231,7 +231,7 @@ bool CActiveMasternode::Dseep(CTxIn vin, CService service, CKey keyMasternode, C } bool CActiveMasternode::Register(std::string strService, std::string strKeyMasternode, std::string txHash, std::string strOutputIndex, std::string strDonationAddress, std::string strDonationPercentage, std::string& errorMessage) { - CTxIn vin; + CTxIn vin; CPubKey pubKeyCollateralAddress; CKey keyCollateralAddress; CPubKey pubKeyMasternode; @@ -241,22 +241,22 @@ bool CActiveMasternode::Register(std::string strService, std::string strKeyMaste if(!darkSendSigner.SetKey(strKeyMasternode, errorMessage, keyMasternode, pubKeyMasternode)) { - LogPrintf("CActiveMasternode::Register() - Error upon calling SetKey: %s\n", errorMessage.c_str()); - return false; + LogPrintf("CActiveMasternode::Register() - Error upon calling SetKey: %s\n", errorMessage.c_str()); + return false; } if(!GetMasterNodeVin(vin, pubKeyCollateralAddress, keyCollateralAddress, txHash, strOutputIndex)) { - errorMessage = "could not allocate vin"; - LogPrintf("Register::Register() - Error: %s\n", errorMessage.c_str()); - return false; - } + errorMessage = "could not allocate vin"; + LogPrintf("CActiveMasternode::Register() - Error: %s\n", errorMessage.c_str()); + return false; + } CBitcoinAddress address; - if (strDonationAddress != "") + if (strDonationAddress != "") { if(!address.SetString(strDonationAddress)) { - LogPrintf("Register::Register - Invalid Donation Address\n"); + LogPrintf("CActiveMasternode::Register - Invalid Donation Address\n"); return false; } donationAddress.SetDestination(address.Get()); @@ -264,18 +264,18 @@ bool CActiveMasternode::Register(std::string strService, std::string strKeyMaste try { donationPercentage = boost::lexical_cast( strDonationPercentage ); } catch( boost::bad_lexical_cast const& ) { - LogPrintf("Register::Register - Invalid Donation Percentage (Couldn't cast)\n"); + LogPrintf("CActiveMasternode::Register - Invalid Donation Percentage (Couldn't cast)\n"); return false; } if(donationPercentage < 0 || donationPercentage > 100) { - LogPrintf("Register::Register - Donation Percentage Out Of Range\n"); + LogPrintf("CActiveMasternode::Register - Donation Percentage Out Of Range\n"); return false; } } - return Register(vin, CService(strService), keyCollateralAddress, pubKeyCollateralAddress, keyMasternode, pubKeyMasternode, donationAddress, donationPercentage, errorMessage); + return Register(vin, CService(strService), keyCollateralAddress, pubKeyCollateralAddress, keyMasternode, pubKeyMasternode, donationAddress, donationPercentage, errorMessage); } bool CActiveMasternode::Register(CTxIn vin, CService service, CKey keyCollateralAddress, CPubKey pubKeyCollateralAddress, CKey keyMasternode, CPubKey pubKeyMasternode, CScript donationAddress, int donationPercentage, std::string &retErrorMessage) { @@ -290,16 +290,16 @@ bool CActiveMasternode::Register(CTxIn vin, CService service, CKey keyCollateral std::string strMessage = service.ToString() + boost::lexical_cast(masterNodeSignatureTime) + vchPubKey + vchPubKey2 + boost::lexical_cast(PROTOCOL_VERSION) + donationAddress.ToString() + boost::lexical_cast(donationPercentage); if(!darkSendSigner.SignMessage(strMessage, errorMessage, vchMasterNodeSignature, keyCollateralAddress)) { - retErrorMessage = "sign message failed: " + errorMessage; - LogPrintf("CActiveMasternode::Register() - Error: %s\n", retErrorMessage.c_str()); - return false; + retErrorMessage = "sign message failed: " + errorMessage; + LogPrintf("CActiveMasternode::Register() - Error: %s\n", retErrorMessage.c_str()); + return false; } if(!darkSendSigner.VerifyMessage(pubKeyCollateralAddress, vchMasterNodeSignature, strMessage, errorMessage)) { - retErrorMessage = "Verify message failed: " + errorMessage; - LogPrintf("CActiveMasternode::Register() - Error: %s\n", retErrorMessage.c_str()); - return false; - } + retErrorMessage = "Verify message failed: " + errorMessage; + LogPrintf("CActiveMasternode::Register() - Error: %s\n", retErrorMessage.c_str()); + return false; + } CMasternode* pmn = mnodeman.Find(vin); if(pmn == NULL) @@ -318,7 +318,7 @@ bool CActiveMasternode::Register(CTxIn vin, CService service, CKey keyCollateral } bool CActiveMasternode::GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secretKey) { - return GetMasterNodeVin(vin, pubkey, secretKey, "", ""); + return GetMasterNodeVin(vin, pubkey, secretKey, "", ""); } bool CActiveMasternode::GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secretKey, std::string strTxHash, std::string strOutputIndex) { @@ -329,35 +329,35 @@ bool CActiveMasternode::GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secr COutput *selectedOutput; // Find the vin - if(!strTxHash.empty()) { - // Let's find it - uint256 txHash(strTxHash); + if(!strTxHash.empty()) { + // Let's find it + uint256 txHash(strTxHash); int outputIndex = boost::lexical_cast(strOutputIndex); - bool found = false; - BOOST_FOREACH(COutput& out, possibleCoins) { - if(out.tx->GetHash() == txHash && out.i == outputIndex) - { - selectedOutput = &out; - found = true; - break; - } - } - if(!found) { - LogPrintf("CActiveMasternode::GetMasterNodeVin - Could not locate valid vin\n"); - return false; - } - } else { - // No output specified, Select the first one - if(possibleCoins.size() > 0) { - selectedOutput = &possibleCoins[0]; - } else { - LogPrintf("CActiveMasternode::GetMasterNodeVin - Could not locate specified vin from possible list\n"); - return false; - } + bool found = false; + BOOST_FOREACH(COutput& out, possibleCoins) { + if(out.tx->GetHash() == txHash && out.i == outputIndex) + { + selectedOutput = &out; + found = true; + break; + } + } + if(!found) { + LogPrintf("CActiveMasternode::GetMasterNodeVin - Could not locate valid vin\n"); + return false; + } + } else { + // No output specified, Select the first one + if(possibleCoins.size() > 0) { + selectedOutput = &possibleCoins[0]; + } else { + LogPrintf("CActiveMasternode::GetMasterNodeVin - Could not locate specified vin from possible list\n"); + return false; + } } - // At this point we have a selected output, retrieve the associated info - return GetVinFromOutput(*selectedOutput, vin, pubkey, secretKey); + // At this point we have a selected output, retrieve the associated info + return GetVinFromOutput(*selectedOutput, vin, pubkey, secretKey); } @@ -366,10 +366,10 @@ bool CActiveMasternode::GetVinFromOutput(COutput out, CTxIn& vin, CPubKey& pubke CScript pubScript; - vin = CTxIn(out.tx->GetHash(),out.i); + vin = CTxIn(out.tx->GetHash(),out.i); pubScript = out.tx->vout[out.i].scriptPubKey; // the inputs PubKey - CTxDestination address1; + CTxDestination address1; ExtractDestination(pubScript, address1); CBitcoinAddress address2(address1); @@ -401,7 +401,7 @@ vector CActiveMasternode::SelectCoinsMasternode() BOOST_FOREACH(const COutput& out, vCoins) { if(out.tx->vout[out.i].nValue == 1000*COIN) { //exactly - filteredCoins.push_back(out); + filteredCoins.push_back(out); } } return filteredCoins; From e3d333f8b266284349917668b6cac6a3942d5f1e Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sun, 22 Mar 2015 03:15:20 +0300 Subject: [PATCH 6/7] converted from "fix possible block db breakage during re-index" https://github.com/bitcoin/bitcoin/commit/bb6acff07982dda68b5c2ac81c99dbd7255bb9cc --- src/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 4358f2a0d..130ad515e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2742,8 +2742,11 @@ bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAdd pos.nPos = infoLastBlockFile.nSize; } - infoLastBlockFile.nSize += nAddSize; infoLastBlockFile.AddBlock(nHeight, nTime); + if (fKnown) + infoLastBlockFile.nSize = std::max(pos.nPos + nAddSize, infoLastBlockFile.nSize); + else + infoLastBlockFile.nSize += nAddSize; if (!fKnown) { unsigned int nOldChunks = (pos.nPos + BLOCKFILE_CHUNK_SIZE - 1) / BLOCKFILE_CHUNK_SIZE; From 9bafb70a2f3ca9161f58ffd5eccb69f237f87623 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Sat, 21 Mar 2015 20:26:48 -0700 Subject: [PATCH 7/7] changed some locks --- src/darksend.cpp | 3 ++- src/darksend.h | 1 + src/masternode.cpp | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/darksend.cpp b/src/darksend.cpp index ad30ac3d3..69f5d206a 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -102,7 +102,8 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand } } else if (strCommand == "dsq") { //Darksend Queue - TRY_LOCK(cs_darksend); + TRY_LOCK(cs_darksend, lockRecv); + if(!lockRecv) return; if (pfrom->nVersion < MIN_POOL_PEER_PROTO_VERSION) { return; diff --git a/src/darksend.h b/src/darksend.h index 9d25b7afa..ea4b6aa7d 100644 --- a/src/darksend.h +++ b/src/darksend.h @@ -7,6 +7,7 @@ #include "core.h" #include "main.h" +#include "sync.h" #include "activemasternode.h" #include "masternodeman.h" #include "darksend-relay.h" diff --git a/src/masternode.cpp b/src/masternode.cpp index 5cabe934a..5542c6173 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -7,6 +7,7 @@ #include "darksend.h" #include "core.h" #include "util.h" +#include "sync.h" #include "addrman.h" #include @@ -222,7 +223,9 @@ uint256 CMasternode::CalculateScore(int mod, int64_t nBlockHeight) void CMasternode::Check() { - TRY_LOCK(cs_main); + //TODO: Random segfault with this line removed + TRY_LOCK(cs_main, lockRecv); + if(!lockRecv) return; if(nScanningErrorCount >= MASTERNODE_SCANNING_ERROR_THESHOLD) {