diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-04-16 10:27:25 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-04-16 10:33:29 +0200 |
commit | 8f955b9661224adc950e302b42d2f7bcb5e90bef (patch) | |
tree | 0a153de67ade81f4b50518191314660a75e6a95b /src | |
parent | bc8535b7175ea4b1bff49fe6bef32017cf5f472a (diff) | |
parent | 0421c18f3a261f04e83a03f59884e5798af74fd9 (diff) |
Merge pull request #6012
0421c18 Fix CheckBlockIndex for reindex. (mrbandrews)
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++) { |