aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2016-04-10 18:52:32 -0700
committerMatt Corallo <git@bluematt.me>2016-06-19 01:34:57 -0700
commit7c29ec94490a2fb0b5f9aec56c89d0a9a58eec79 (patch)
tree7a39b8d4cb964bbf6eabc5090cc29f90091e0001 /src
parent96806c39f4ef395975c0cd7d654dcb71c4790be2 (diff)
If AcceptBlockHeader returns true, pindex will be set.
Assert this instead of checking (and then dref'ing later anyway) to make sure no one thinks they can change that postcondition of AcceptBlockHeader..
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index bdb3457f8e..378d2c7022 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -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.