aboutsummaryrefslogtreecommitdiff
path: root/src/node
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2021-09-21 12:10:51 -0400
committerCarl Dong <contact@carldong.me>2021-12-07 14:48:49 -0500
commitc541da0d62eaf5e96eca00d7508899f98bdfc1bc (patch)
tree0abe8e218e7099cce8bd26c9d9ba9bb601a80bb3 /src/node
parentceb979034184345a662be4e3b327a573fbb31c63 (diff)
downloadbitcoin-c541da0d62eaf5e96eca00d7508899f98bdfc1bc.tar.xz
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.
Diffstat (limited to 'src/node')
-rw-r--r--src/node/chainstate.cpp6
-rw-r--r--src/node/chainstate.h2
2 files changed, 6 insertions, 2 deletions
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<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) {
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<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);