Skip to content

Commit

Permalink
If AcceptBlockHeader returns true, pindex will be set.
Browse files Browse the repository at this point in the history
Assert this instead of checking (and then dref'ing later anyway)
to make sure no one thinks they can change that postcondition of
AcceptBlockHeader..
  • Loading branch information
TheBlueMatt committed Jun 19, 2016
1 parent 96806c3 commit 7c29ec9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5218,10 +5218,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
}

if (pindexLast)
UpdateBlockAvailability(pfrom->GetId(), pindexLast->GetBlockHash());
assert(pindexLast);
UpdateBlockAvailability(pfrom->GetId(), pindexLast->GetBlockHash());

if (nCount == MAX_HEADERS_RESULTS && pindexLast && hasNewHeaders) {
if (nCount == MAX_HEADERS_RESULTS && hasNewHeaders) {
// Headers message had its maximum size; the peer may have more headers.
// TODO: optimize: if pindexLast is an ancestor of chainActive.Tip or pindexBestHeader, continue
// from there instead.
Expand Down

0 comments on commit 7c29ec9

Please sign in to comment.