mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-28 05:13:03 +02:00
node/chainstate: Add options for in-memory DBs
[META] In a future commit, these options will be used in TestingSetup to ensure that the DBs are in-memory.
This commit is contained in:
parent
ceb9790341
commit
c541da0d62
@ -1415,6 +1415,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
cache_sizes.block_tree_db,
|
||||
cache_sizes.coins_db,
|
||||
cache_sizes.coins,
|
||||
false,
|
||||
false,
|
||||
ShutdownRequested,
|
||||
[]() {
|
||||
uiInterface.ThreadSafeMessageBox(
|
||||
|
@ -17,6 +17,8 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
|
||||
int64_t nBlockTreeDBCache,
|
||||
int64_t nCoinDBCache,
|
||||
int64_t nCoinCacheUsage,
|
||||
bool block_tree_db_in_memory,
|
||||
bool coins_db_in_memory,
|
||||
std::function<bool()> shutdown_requested,
|
||||
std::function<void()> coins_error_cb)
|
||||
{
|
||||
@ -36,7 +38,7 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
|
||||
// new CBlockTreeDB tries to delete the existing file, which
|
||||
// fails if it's still open from the previous loop. Close it first:
|
||||
pblocktree.reset();
|
||||
pblocktree.reset(new CBlockTreeDB(nBlockTreeDBCache, false, fReset));
|
||||
pblocktree.reset(new CBlockTreeDB(nBlockTreeDBCache, block_tree_db_in_memory, fReset));
|
||||
|
||||
if (fReset) {
|
||||
pblocktree->WriteReindexing(true);
|
||||
@ -81,7 +83,7 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
|
||||
for (CChainState* chainstate : chainman.GetAll()) {
|
||||
chainstate->InitCoinsDB(
|
||||
/* cache_size_bytes */ nCoinDBCache,
|
||||
/* in_memory */ false,
|
||||
/* in_memory */ coins_db_in_memory,
|
||||
/* should_wipe */ fReset || fReindexChainState);
|
||||
|
||||
if (coins_error_cb) {
|
||||
|
@ -63,6 +63,8 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
|
||||
int64_t nBlockTreeDBCache,
|
||||
int64_t nCoinDBCache,
|
||||
int64_t nCoinCacheUsage,
|
||||
bool block_tree_db_in_memory,
|
||||
bool coins_db_in_memory,
|
||||
std::function<bool()> shutdown_requested = nullptr,
|
||||
std::function<void()> coins_error_cb = nullptr);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user