mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
test: allow on-disk coins and block tree dbs in tests
Used when testing cleanup of on-disk chainstate data for snapshot testcases. Also necessary for simulating node restart in .cpp tests.
This commit is contained in:
@@ -220,8 +220,14 @@ ChainTestingSetup::~ChainTestingSetup()
|
||||
m_node.chainman.reset();
|
||||
}
|
||||
|
||||
TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const char*>& extra_args)
|
||||
: ChainTestingSetup(chainName, extra_args)
|
||||
TestingSetup::TestingSetup(
|
||||
const std::string& chainName,
|
||||
const std::vector<const char*>& extra_args,
|
||||
const bool coins_db_in_memory,
|
||||
const bool block_tree_db_in_memory)
|
||||
: ChainTestingSetup(chainName, extra_args),
|
||||
m_coins_db_in_memory(coins_db_in_memory),
|
||||
m_block_tree_db_in_memory(block_tree_db_in_memory)
|
||||
{
|
||||
// Ideally we'd move all the RPC tests to the functional testing framework
|
||||
// instead of unit tests, but for now we need these here.
|
||||
@@ -229,8 +235,8 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
|
||||
|
||||
node::ChainstateLoadOptions options;
|
||||
options.mempool = Assert(m_node.mempool.get());
|
||||
options.block_tree_db_in_memory = true;
|
||||
options.coins_db_in_memory = true;
|
||||
options.block_tree_db_in_memory = m_block_tree_db_in_memory;
|
||||
options.coins_db_in_memory = m_coins_db_in_memory;
|
||||
options.reindex = node::fReindex;
|
||||
options.reindex_chainstate = m_args.GetBoolArg("-reindex-chainstate", false);
|
||||
options.prune = node::fPruneMode;
|
||||
@@ -263,8 +269,12 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
|
||||
}
|
||||
}
|
||||
|
||||
TestChain100Setup::TestChain100Setup(const std::string& chain_name, const std::vector<const char*>& extra_args)
|
||||
: TestingSetup{chain_name, extra_args}
|
||||
TestChain100Setup::TestChain100Setup(
|
||||
const std::string& chain_name,
|
||||
const std::vector<const char*>& extra_args,
|
||||
const bool coins_db_in_memory,
|
||||
const bool block_tree_db_in_memory)
|
||||
: TestingSetup{CBaseChainParams::REGTEST, extra_args, coins_db_in_memory, block_tree_db_in_memory}
|
||||
{
|
||||
SetMockTime(1598887952);
|
||||
constexpr std::array<unsigned char, 32> vchKey = {
|
||||
|
||||
Reference in New Issue
Block a user