aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 4a2682bc78..4cd5bebb7c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5982,14 +5982,14 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
ReadCompactSize(vRecv); // ignore tx count; assume it is 0.
}
- {
- LOCK(cs_main);
-
if (nCount == 0) {
// Nothing interesting. Stop asking this peers for more headers.
return true;
}
+ CBlockIndex *pindexLast = NULL;
+ {
+ LOCK(cs_main);
CNodeState *nodestate = State(pfrom->GetId());
// If this looks like it could be a block announcement (nCount <
@@ -6019,7 +6019,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
return true;
}
- CBlockIndex *pindexLast = NULL;
BOOST_FOREACH(const CBlockHeader& header, headers) {
CValidationState state;
if (pindexLast != NULL && header.hashPrevBlock != pindexLast->GetBlockHash()) {
@@ -6035,7 +6034,11 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
}
}
+ }
+ {
+ LOCK(cs_main);
+ CNodeState *nodestate = State(pfrom->GetId());
if (nodestate->nUnconnectingHeaders > 0) {
LogPrint("net", "peer=%d: resetting nUnconnectingHeaders (%d -> 0)\n", pfrom->id, nodestate->nUnconnectingHeaders);
}