diff options
author | Matt Corallo <git@bluematt.me> | 2017-07-06 19:57:20 -0400 |
---|---|---|
committer | Matt Corallo <git@bluematt.me> | 2017-07-27 15:03:05 -0400 |
commit | eda888e57352037ab2e60f6ef90098b3ce23a157 (patch) | |
tree | d8e500283bc5ba0e68f2cd4c6a255e8e04ccfd20 /src/test/test_bitcoin.cpp | |
parent | 5cfdda2503c995cdd563b1a2a29162ac298d173d (diff) |
Fix some LoadChainTip-related init-order bugs.
* Move the writing of fTxIndex to LoadBlockIndex - this fixes a
bug introduced in d6af06d68aae985436cbc942f0d11078041d121b where
InitBlockIndex was writing to fTxIndex which had not yet been
checked (because LoadChainTip hadn't yet initialized the
chainActive, which would otherwise have resulted in
InitBlockIndex being a NOP), allowing you to modify -txindex
without reindex, potentially corrupting your chainstate!
* Rename InitBlockIndex to LoadGenesisBlock, which is now a more
natural name for it. Also check mapBlockIndex instead of
chainActive, fixing a bug where we'd write the genesis block out
on every start.
Diffstat (limited to 'src/test/test_bitcoin.cpp')
-rw-r--r-- | src/test/test_bitcoin.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp index 3ba81ed17b..8ad955e7a2 100644 --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -72,7 +72,7 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha pblocktree = new CBlockTreeDB(1 << 20, true); pcoinsdbview = new CCoinsViewDB(1 << 23, true); pcoinsTip = new CCoinsViewCache(pcoinsdbview); - if (!InitBlockIndex(chainparams)) { + if (!LoadGenesisBlock(chainparams)) { throw std::runtime_error("InitBlockIndex failed."); } { |