Skip to content

Commit

Permalink
Move all calls to CheckBlockIndex out of net-processing logic
Browse files Browse the repository at this point in the history
This will result in many more calls to CheckBlockIndex when
connecting a list of headers (eg in ::HEADERS messages processing)
but its only enabled in debug mode, and that should mostly just be
during IBD, so it should be OK.
  • Loading branch information
TheBlueMatt committed Oct 31, 2016
1 parent d6ea737 commit d8670fb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3675,6 +3675,8 @@ static bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state
if (ppindex)
*ppindex = pindex;

CheckBlockIndex(chainparams.GetConsensus());

return true;
}

Expand Down Expand Up @@ -5827,8 +5829,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
return ProcessMessage(pfrom, NetMsgType::HEADERS, vHeadersMsg, nTimeReceived, chainparams, connman);
}
}

CheckBlockIndex(chainparams.GetConsensus());
}

else if (strCommand == NetMsgType::BLOCKTXN && !fImporting && !fReindex) // Ignore blocks received while importing
Expand Down Expand Up @@ -6025,8 +6025,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
}
}

CheckBlockIndex(chainparams.GetConsensus());
}

NotifyHeaderTip();
Expand Down

0 comments on commit d8670fb

Please sign in to comment.