Few more lock-related fixes:

- do not lock cs_main for mnodeman.CheckAndRemove() - we have trylock inside CMasternode.Check, should be enough
- fast cs_main lock for ix
- use RelayInv instead of manually locking nodes / pushing inv
- do not lock cs_vNodes / ClearFulfilledRequest on every 100th block, CMasternodeSync should already handle resync by itself better now
This commit is contained in:
UdjinM6 2015-08-05 01:49:34 +03:00
parent ff159ad7e7
commit 7d78c98f0d
3 changed files with 9 additions and 36 deletions

View File

@ -2219,16 +2219,7 @@ void ThreadCheckDarkSendPool()
if(c % 60 == 0)
{
{
LOCK(cs_main);
/*
cs_main is required for doing CMasternode.Check because something
is modifying the coins view without a mempool lock. It causes
segfaults from this code without the cs_main lock.
*/
mnodeman.CheckAndRemove();
}
mnodeman.CheckAndRemove();
mnodeman.ProcessMasternodeConnections();
masternodePayments.CleanPaymentList();
CleanTransactionLocksList();

View File

@ -70,14 +70,14 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
bool fMissingInputs = false;
CValidationState state;
LOCK(cs_main);
if (AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs))
bool fAccepted = false;
{
vector<CInv> vInv;
vInv.push_back(inv);
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
pnode->PushMessage("inv", vInv);
LOCK(cs_main);
fAccepted = AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs);
}
if (fAccepted)
{
RelayInv(inv);
DoConsensusVote(tx, nBlockHeight);
@ -161,12 +161,7 @@ void ProcessMessageInstantX(CNode* pfrom, std::string& strCommand, CDataStream&
mapUnknownVotes[ctx.vinMasternode.prevout.hash] = GetTime()+(60*10);
}
}
vector<CInv> vInv;
vInv.push_back(inv);
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
pnode->PushMessage("inv", vInv);
RelayInv(inv);
}
return;

View File

@ -3279,22 +3279,9 @@ bool ProcessNewBlock(CValidationState &state, CNode* pfrom, CBlock* pblock, CDis
if(!fLiteMode){
if (masternodeSync.RequestedMasternodeAssets > MASTERNODE_SYNC_LIST) {
CScript payee;
CTxIn vin;
darkSendPool.NewBlock();
masternodePayments.ProcessBlock(GetHeight()+10);
budget.NewBlock();
//allow clients to ask for syncing again if they need it
if(GetHeight() % 100 == 0) {
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes) {
pnode->ClearFulfilledRequest("getspork");
pnode->ClearFulfilledRequest("mnsync");
pnode->ClearFulfilledRequest("mnwsync");
pnode->ClearFulfilledRequest("busync");
}
}
}
}