Skip to content

Commit

Permalink
TRY_LOCK for blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Duffield committed Aug 1, 2015
1 parent 44c9941 commit 171c0b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main.cpp
Expand Up @@ -4881,6 +4881,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,

else if (strCommand == "block" && !fImporting && !fReindex) // Ignore blocks received while importing
{
TRY_LOCK(cs_main, lockMainBlock);
if(!lockMainBlock) return;

CBlock block;
vRecv >> block;

Expand All @@ -4896,7 +4899,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
pfrom->PushMessage("reject", strCommand, state.GetRejectCode(),
state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), inv.hash);
if (nDoS > 0) {
LOCK(cs_main);
Misbehaving(pfrom->GetId(), nDoS);
}
}
Expand Down

0 comments on commit 171c0b1

Please sign in to comment.