aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-chainstate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bitcoin-chainstate.cpp')
-rw-r--r--src/bitcoin-chainstate.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/bitcoin-chainstate.cpp b/src/bitcoin-chainstate.cpp
index 5678d4a526..432bdc8e33 100644
--- a/src/bitcoin-chainstate.cpp
+++ b/src/bitcoin-chainstate.cpp
@@ -17,8 +17,6 @@
#include <kernel/context.h>
#include <kernel/validation_cache_sizes.h>
-#include <chainparams.h>
-#include <common/args.h>
#include <consensus/validation.h>
#include <core_io.h>
#include <node/blockstorage.h>
@@ -53,13 +51,9 @@ int main(int argc, char* argv[])
}
std::filesystem::path abs_datadir = std::filesystem::absolute(argv[1]);
std::filesystem::create_directories(abs_datadir);
- gArgs.ForceSetArg("-datadir", abs_datadir.string());
- // SETUP: Misc Globals
- SelectParams(ChainType::MAIN);
- auto chainparams = CChainParams::Main();
-
+ // SETUP: Context
kernel::Context kernel_context{};
// We can't use a goto here, but we can use an assert since none of the
// things instantiated so far requires running the epilogue to be torn down
@@ -106,16 +100,18 @@ int main(int argc, char* argv[])
};
auto notifications = std::make_unique<KernelNotifications>();
+
// SETUP: Chainstate
+ auto chainparams = CChainParams::Main();
const ChainstateManager::Options chainman_opts{
.chainparams = *chainparams,
- .datadir = gArgs.GetDataDirNet(),
+ .datadir = abs_datadir,
.adjusted_time_callback = NodeClock::now,
.notifications = *notifications,
};
const node::BlockManager::Options blockman_opts{
.chainparams = chainman_opts.chainparams,
- .blocks_dir = gArgs.GetBlocksDirPath(),
+ .blocks_dir = abs_datadir / "blocks",
};
ChainstateManager chainman{chainman_opts, blockman_opts};
@@ -148,7 +144,8 @@ int main(int argc, char* argv[])
// Main program logic starts here
std::cout
<< "Hello! I'm going to print out some information about your datadir." << std::endl
- << "\t" << "Path: " << gArgs.GetDataDirNet() << std::endl;
+ << "\t"
+ << "Path: " << abs_datadir << std::endl;
{
LOCK(chainman.GetMutex());
std::cout