From c541da0d62eaf5e96eca00d7508899f98bdfc1bc Mon Sep 17 00:00:00 2001 From: Carl Dong Date: Tue, 21 Sep 2021 12:10:51 -0400 Subject: 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. --- src/node/chainstate.cpp | 6 ++++-- src/node/chainstate.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/node') diff --git a/src/node/chainstate.cpp b/src/node/chainstate.cpp index b4264655d5..35d4b4cc8c 100644 --- a/src/node/chainstate.cpp +++ b/src/node/chainstate.cpp @@ -17,6 +17,8 @@ std::optional 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 shutdown_requested, std::function coins_error_cb) { @@ -36,7 +38,7 @@ std::optional 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 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) { diff --git a/src/node/chainstate.h b/src/node/chainstate.h index e3369eb47c..c3b8baf7fc 100644 --- a/src/node/chainstate.h +++ b/src/node/chainstate.h @@ -63,6 +63,8 @@ std::optional 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 shutdown_requested = nullptr, std::function coins_error_cb = nullptr); -- cgit v1.2.3