Skip to content

Commit

Permalink
CDBWrapper: Pass in -forcecompactdb via ::Options
Browse files Browse the repository at this point in the history
This removes all references to gArgs from src/dbwrapper.cpp
  • Loading branch information
dongcarl committed Jul 20, 2022
1 parent df3463e commit d29f09a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/dbwrapper.cpp
Expand Up @@ -157,7 +157,7 @@ CDBWrapper::CDBWrapper(const Options& opts)
dbwrapper_private::HandleError(status);
LogPrintf("Opened LevelDB successfully\n");

if (gArgs.GetBoolArg("-forcecompactdb", false)) {
if (opts.do_compact) {
LogPrintf("Starting database compaction of %s\n", fs::PathToString(opts.db_path));
pdb->CompactRange(nullptr, nullptr);
LogPrintf("Finished database compaction of %s\n", fs::PathToString(opts.db_path));
Expand Down
2 changes: 2 additions & 0 deletions src/dbwrapper.h
Expand Up @@ -227,6 +227,7 @@ class CDBWrapper
bool in_memory = false;
bool wipe_existing = false;
bool obfuscate_data = false;
bool do_compact = false;
};

CDBWrapper(const fs::path& path, size_t nCacheSize, bool fMemory = false, bool fWipe = false, bool obfuscate = false)
Expand All @@ -236,6 +237,7 @@ class CDBWrapper
.in_memory = fMemory,
.wipe_existing = fWipe,
.obfuscate_data = obfuscate,
.do_compact = gArgs.GetBoolArg("-forcecompactdb", false),
}} {}
CDBWrapper(const Options& opts);
~CDBWrapper();
Expand Down

0 comments on commit d29f09a

Please sign in to comment.