mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 13:32:47 +01:00
Don't hold cs_main when calling ProcessNewBlock from a cmpctblock
This commit is contained in:
parent
df7519cbc1
commit
72ca7d924e
@ -5787,6 +5787,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
BlockTransactions resp;
|
||||
vRecv >> resp;
|
||||
|
||||
CBlock block;
|
||||
bool fBlockRead = false;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
|
||||
map<uint256, pair<NodeId, list<QueuedBlock>::iterator> >::iterator it = mapBlocksInFlight.find(resp.blockhash);
|
||||
@ -5797,7 +5800,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
}
|
||||
|
||||
PartiallyDownloadedBlock& partialBlock = *it->second.second->partialBlock;
|
||||
CBlock block;
|
||||
ReadStatus status = partialBlock.FillBlock(block, resp.txn);
|
||||
if (status == READ_STATUS_INVALID) {
|
||||
MarkBlockAsReceived(resp.blockhash); // Reset in-flight state in case of whitelist
|
||||
@ -5809,7 +5811,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
std::vector<CInv> invs;
|
||||
invs.push_back(CInv(MSG_BLOCK | GetFetchFlags(pfrom, chainActive.Tip(), chainparams.GetConsensus()), resp.blockhash));
|
||||
pfrom->PushMessage(NetMsgType::GETDATA, invs);
|
||||
} else {
|
||||
} else
|
||||
fBlockRead = true;
|
||||
} // Don't hold cs_main when we call into ProcessNewBlock
|
||||
if (fBlockRead) {
|
||||
CValidationState state;
|
||||
ProcessNewBlock(state, chainparams, pfrom, &block, false, NULL, &connman);
|
||||
int nDoS;
|
||||
|
Loading…
Reference in New Issue
Block a user