From 89eddcd365e9a2218648f5cc5b9f22b28023f50a Mon Sep 17 00:00:00 2001 From: Jim Posen Date: Tue, 15 May 2018 17:26:49 -0700 Subject: [PATCH] index: Remove TxIndexDB from public interface of TxIndex. --- src/index/txindex.cpp | 4 +++- src/index/txindex.h | 2 +- src/init.cpp | 3 +-- src/test/txindex_tests.cpp | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp index 7d3d2fed523..328039977fc 100644 --- a/src/index/txindex.cpp +++ b/src/index/txindex.cpp @@ -8,7 +8,9 @@ std::unique_ptr g_txindex; -TxIndex::TxIndex(std::unique_ptr db) : m_db(std::move(db)) {} +TxIndex::TxIndex(size_t n_cache_size, bool f_memory, bool f_wipe) + : m_db(MakeUnique(n_cache_size, f_memory, f_wipe)) +{} bool TxIndex::Init() { diff --git a/src/index/txindex.h b/src/index/txindex.h index fb92ad98dcb..2a0c70e9d14 100644 --- a/src/index/txindex.h +++ b/src/index/txindex.h @@ -29,7 +29,7 @@ protected: public: /// Constructs the index, which becomes available to be queried. - explicit TxIndex(std::unique_ptr db); + explicit TxIndex(size_t n_cache_size, bool f_memory = false, bool f_wipe = false); /// Look up a transaction by hash. /// diff --git a/src/init.cpp b/src/init.cpp index b4e2eec0d25..9246f6e71cd 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1606,8 +1606,7 @@ bool AppInitMain() // ********************************************************* Step 8: start indexers if (gArgs.GetBoolArg("-txindex", DEFAULT_TXINDEX)) { - auto txindex_db = MakeUnique(nTxIndexCache, false, fReindex); - g_txindex = MakeUnique(std::move(txindex_db)); + g_txindex = MakeUnique(nTxIndexCache, false, fReindex); g_txindex->Start(); } diff --git a/src/test/txindex_tests.cpp b/src/test/txindex_tests.cpp index 14158f2875f..be7ee2428b2 100644 --- a/src/test/txindex_tests.cpp +++ b/src/test/txindex_tests.cpp @@ -15,7 +15,7 @@ BOOST_AUTO_TEST_SUITE(txindex_tests) BOOST_FIXTURE_TEST_CASE(txindex_initial_sync, TestChain100Setup) { - TxIndex txindex(MakeUnique(1 << 20, true)); + TxIndex txindex(1 << 20, true); CTransactionRef tx_disk; uint256 block_hash;