From a1926362ecb3c354ae338ef7d7020daf78f980c9 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Sun, 11 Mar 2018 12:42:02 +0800 Subject: [PATCH] -blocksdir: keep blockindex leveldb database in datadir --- src/txdb.cpp | 2 +- test/functional/feature_blocksdir.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/txdb.cpp b/src/txdb.cpp index f6d60411b4..4a2c321885 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -147,7 +147,7 @@ size_t CCoinsViewDB::EstimateSize() const return db.EstimateSize(DB_COIN, (char)(DB_COIN+1)); } -CBlockTreeDB::CBlockTreeDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(GetBlocksDir() / "index", nCacheSize, fMemory, fWipe) { +CBlockTreeDB::CBlockTreeDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(gArgs.IsArgSet("-blocksdir") ? GetDataDir() / "blocks" / "index" : GetBlocksDir() / "index", nCacheSize, fMemory, fWipe) { } bool CBlockTreeDB::ReadBlockFileInfo(int nFile, CBlockFileInfo &info) { diff --git a/test/functional/feature_blocksdir.py b/test/functional/feature_blocksdir.py index e9d7b9de5b..6ee6cb9a3e 100755 --- a/test/functional/feature_blocksdir.py +++ b/test/functional/feature_blocksdir.py @@ -27,8 +27,8 @@ class BlocksdirTest(BitcoinTestFramework): self.start_node(0, ["-blocksdir="+self.options.tmpdir+ "/blocksdir"]) self.log.info("mining blocks..") self.nodes[0].generate(10) - assert(os.path.isfile(self.options.tmpdir+ "/blocksdir/regtest/blocks/blk00000.dat")) - assert(os.path.isdir(self.options.tmpdir+ "/blocksdir/regtest/blocks/index")) + assert(os.path.isfile(os.path.join(self.options.tmpdir, "blocksdir", "regtest", "blocks", "blk00000.dat"))) + assert(os.path.isdir(os.path.join(self.options.tmpdir, "node0", "regtest", "blocks", "index"))) if __name__ == '__main__': BlocksdirTest().main()