diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-07-20 17:37:21 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-07-20 17:37:29 +0200 |
commit | 951850bebfde0949c85aaffda1573face5d18c23 (patch) | |
tree | 90fd882c03bde7fc9371226ffe7764ac2781dbaa /src/test | |
parent | 9faa4b68db80a4a5c1f5a4e0484d804d7b5e1493 (diff) | |
parent | faa54e375782b21cbc2761c763128131c569e903 (diff) | |
download | bitcoin-951850bebfde0949c85aaffda1573face5d18c23.tar.xz |
Merge bitcoin/bitcoin#22371: Move pblocktree global to BlockManager
faa54e375782b21cbc2761c763128131c569e903 Move pblocktree global to BlockManager (MarcoFalke)
fa27f03b4943540aa2eab283d4cf50ad4a1a01f8 Move LoadBlockIndexDB to BlockManager (MarcoFalke)
Pull request description:
The block tree db is used within BlockManager to write and read the block index, so make the db global a member variable of BlockManager.
ACKs for top commit:
jamesob:
ACK faa54e375782b21cbc2761c763128131c569e903 ([`jamesob/ackr/22371.1.MarcoFalke.move_pblocktree_global_t`](https://github.com/jamesob/bitcoin/tree/ackr/22371.1.MarcoFalke.move_pblocktree_global_t))
theStack:
re-ACK faa54e375782b21cbc2761c763128131c569e903 🥧
ryanofsky:
Code review ACK faa54e375782b21cbc2761c763128131c569e903. I was thinking this looked like a change Carl would like, so no surprised he [Mega-acked](https://github.com/bitcoin/bitcoin/pull/22371#pullrequestreview-696450475)
Tree-SHA512: 1b7badbf503d53f5d4dbd9ed8f2e5c1ebfe48102665197048cc9e37bc87b5cec5f2277f3aae9f73a1095bfe879b19d288286ca3daa28031f5f1b64b1184439a9
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/util/setup_common.cpp | 4 | ||||
-rw-r--r-- | src/test/validation_chainstate_tests.cpp | 1 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index d9d236be1d..5334c4623e 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -141,12 +141,11 @@ ChainTestingSetup::ChainTestingSetup(const std::string& chainName, const std::ve m_node.scheduler->m_service_thread = std::thread(util::TraceThread, "scheduler", [&] { m_node.scheduler->serviceQueue(); }); GetMainSignals().RegisterBackgroundSignalScheduler(*m_node.scheduler); - pblocktree.reset(new CBlockTreeDB(1 << 20, true)); - m_node.fee_estimator = std::make_unique<CBlockPolicyEstimator>(); m_node.mempool = std::make_unique<CTxMemPool>(m_node.fee_estimator.get(), 1); m_node.chainman = std::make_unique<ChainstateManager>(); + m_node.chainman->m_blockman.m_block_tree_db = std::make_unique<CBlockTreeDB>(1 << 20, true); // Start script-checking threads. Set g_parallel_script_checks to true so they are used. constexpr int script_check_threads = 2; @@ -169,7 +168,6 @@ ChainTestingSetup::~ChainTestingSetup() m_node.scheduler.reset(); m_node.chainman->Reset(); m_node.chainman.reset(); - pblocktree.reset(); } TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const char*>& extra_args) diff --git a/src/test/validation_chainstate_tests.cpp b/src/test/validation_chainstate_tests.cpp index 2893b412fb..315ef22599 100644 --- a/src/test/validation_chainstate_tests.cpp +++ b/src/test/validation_chainstate_tests.cpp @@ -20,6 +20,7 @@ BOOST_FIXTURE_TEST_SUITE(validation_chainstate_tests, TestingSetup) BOOST_AUTO_TEST_CASE(validation_chainstate_resize_caches) { ChainstateManager manager; + WITH_LOCK(::cs_main, manager.m_blockman.m_block_tree_db = std::make_unique<CBlockTreeDB>(1 << 20, true)); CTxMemPool mempool; //! Create and add a Coin with DynamicMemoryUsage of 80 bytes to the given view. |