146 | @@ -147,7 +147,7 @@ size_t CCoinsViewDB::EstimateSize() const
147 | return db.EstimateSize(DB_COIN, (char)(DB_COIN+1));
148 | }
149 |
150 | -CBlockTreeDB::CBlockTreeDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(GetDataDir() / "blocks" / "index", nCacheSize, fMemory, fWipe) {
151 | +CBlockTreeDB::CBlockTreeDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(gArgs.IsArgSet("-blocksdir") ? GetDataDir() / "blockindex" : GetBlocksDir() / "index", nCacheSize, fMemory, fWipe) {
"blockindex"? Should be "blocks" / "index"?
Maybe add GetBlockIndexDir()?
Yes, this seems wrong.
I tried providing my existing blocks directory:
$ src/bitcoind -testnet -blocksdir=/store2/tmp/bitcoin/testnet3/blocks -printtoconsole
2018-03-15T19:29:04Z Opening LevelDB in /.../.bitcoin/testnet3/blockindex
2018-03-15T19:29:04Z Opened LevelDB successfully
...
2018-03-15T19:29:05Z : Error initializing block database.
Please restart with -reindex or -reindex-chainstate to recover.
: Error initializing block database.
Please restart with -reindex or -reindex-chainstate to recover.
This fails. Shouldn't it use the index directory within the blocksdir?
Using the same directory looks most obvious correct, though, if you switch the blocks dir to a different path (with -blocksdir=<path>) users may run into troubles since the old blocks dir may still be in the datadir...
But I agree, lets keep "block" / "Index" for now...
fixed.