From 4d51e9be165d860fac0eb6aff9931092605ccd1f Mon Sep 17 00:00:00 2001 From: NicolasDorier Date: Fri, 9 Sep 2016 11:51:08 +0900 Subject: [PATCH] Assert ConnectBlock block and pIndex are the same block --- src/validation.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/validation.cpp b/src/validation.cpp index a83737377a..3ce7ffc7b2 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1739,7 +1739,10 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin CCoinsViewCache& view, const CChainParams& chainparams, bool fJustCheck) { AssertLockHeld(cs_main); - + assert(pindex); + // pindex->phashBlock can be null if called by CreateNewBlock/TestBlockValidity + assert((pindex->phashBlock == NULL) || + (*pindex->phashBlock == block.GetHash())); int64_t nTimeStart = GetTimeMicros(); // Check it again in case a previous version let a bad block in