diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index f0aa3022cd..8dd61a3720 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3232,6 +3232,14 @@ void static CheckBlockIndex() LOCK(cs_main); + // During a reindex, we read the genesis block and call CheckBlockIndex before ActivateBestChain, + // so we have the genesis block in mapBlockIndex but no active chain. (A few of the tests when + // iterating the block tree require that chainActive has been initialized.) + if (chainActive.Height() < 0) { + assert(mapBlockIndex.size() <= 1); + return; + } + // Build forward-pointing map of the entire block tree. std::multimap<CBlockIndex*,CBlockIndex*> forward; for (BlockMap::iterator it = mapBlockIndex.begin(); it != mapBlockIndex.end(); it++) { |