Merge #8995: Add missing cs_main lock to ::GETBLOCKTXN processing

dfe7906 Add missing cs_main lock to ::GETBLOCKTXN processing (Matt Corallo)
This commit is contained in:
Wladimir J. van der Laan 2016-10-24 11:17:04 +02:00
commit ced22d035a
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6

View File

@ -5442,6 +5442,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
BlockTransactionsRequest req; BlockTransactionsRequest req;
vRecv >> req; vRecv >> req;
LOCK(cs_main);
BlockMap::iterator it = mapBlockIndex.find(req.blockhash); BlockMap::iterator it = mapBlockIndex.find(req.blockhash);
if (it == mapBlockIndex.end() || !(it->second->nStatus & BLOCK_HAVE_DATA)) { if (it == mapBlockIndex.end() || !(it->second->nStatus & BLOCK_HAVE_DATA)) {
LogPrintf("Peer %d sent us a getblocktxn for a block we don't have", pfrom->id); LogPrintf("Peer %d sent us a getblocktxn for a block we don't have", pfrom->id);