Browse files

Add missing cs_main lock to ::GETBLOCKTXN processing

Note that this is not a major issue as, in order for the missing
lock to cause issues, you have to receive a GETBLOCKTXN message
while reindexing, adding a block header via RPC, etc, which results
in either a table rehash or an insert into the bucket which you are
currently looking at.

Github-Pull: #8995
Rebased-From: dfe7906
  • Loading branch information...
1 parent 03422e5 commit 9ef38758a69abfb6166099bf8dea1d69e258ae00 @TheBlueMatt TheBlueMatt committed with laanwj Oct 21, 2016
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/main.cpp
@@ -5388,6 +5388,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
BlockTransactionsRequest req;
vRecv >> req;
+ LOCK(cs_main);
BlockMap::iterator it = mapBlockIndex.find(req.blockhash);
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);

0 comments on commit 9ef3875

Please sign in to comment.