mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-07 11:12:50 +01:00
validation tests: Use existing {Chainstate,Block}Man
Use {Chain,}TestingSetup's existing {Chainstate,Block}Manager and avoid
unnecessarily creating a local one.
This also helps reduce the code diff for a later commit where we change
{Chainstate,Block}Manager's constructor signature.
This commit is contained in:
@@ -4,14 +4,11 @@
|
||||
//
|
||||
#include <sync.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <txmempool.h>
|
||||
#include <validation.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
using node::BlockManager;
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(validation_flush_tests, ChainTestingSetup)
|
||||
BOOST_FIXTURE_TEST_SUITE(validation_flush_tests, TestingSetup)
|
||||
|
||||
//! Test utilities for detecting when we need to flush the coins cache based
|
||||
//! on estimated memory usage.
|
||||
@@ -20,11 +17,7 @@ BOOST_FIXTURE_TEST_SUITE(validation_flush_tests, ChainTestingSetup)
|
||||
//!
|
||||
BOOST_AUTO_TEST_CASE(getcoinscachesizestate)
|
||||
{
|
||||
CTxMemPool& mempool = *Assert(m_node.mempool);
|
||||
BlockManager blockman{};
|
||||
CChainState chainstate{&mempool, blockman, *Assert(m_node.chainman)};
|
||||
chainstate.InitCoinsDB(/*cache_size_bytes=*/1 << 10, /*in_memory=*/true, /*should_wipe=*/false);
|
||||
WITH_LOCK(::cs_main, chainstate.InitCoinsCache(1 << 10));
|
||||
CChainState& chainstate{m_node.chainman->ActiveChainstate()};
|
||||
|
||||
constexpr bool is_64_bit = sizeof(void*) == 8;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user