mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
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:
parent
ff159ad7e7
commit
7d78c98f0d
@ -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();
|
||||
|
@ -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;
|
||||
|
13
src/main.cpp
13
src/main.cpp
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user