|
17 | 17 | #include <kernel/context.h> |
18 | 18 | #include <kernel/validation_cache_sizes.h> |
19 | 19 |
|
20 | | -#include <chainparams.h> |
21 | | -#include <common/args.h> |
22 | 20 | #include <consensus/validation.h> |
23 | 21 | #include <core_io.h> |
24 | 22 | #include <node/blockstorage.h> |
@@ -53,13 +51,9 @@ int main(int argc, char* argv[]) |
53 | 51 | } |
54 | 52 | std::filesystem::path abs_datadir = std::filesystem::absolute(argv[1]); |
55 | 53 | std::filesystem::create_directories(abs_datadir); |
56 | | - gArgs.ForceSetArg("-datadir", abs_datadir.string()); |
57 | 54 |
|
58 | 55 |
|
59 | | - // SETUP: Misc Globals |
60 | | - SelectParams(ChainType::MAIN); |
61 | | - auto chainparams = CChainParams::Main(); |
62 | | - |
| 56 | + // SETUP: Context |
63 | 57 | kernel::Context kernel_context{}; |
64 | 58 | // We can't use a goto here, but we can use an assert since none of the |
65 | 59 | // things instantiated so far requires running the epilogue to be torn down |
@@ -106,16 +100,18 @@ int main(int argc, char* argv[]) |
106 | 100 | }; |
107 | 101 | auto notifications = std::make_unique<KernelNotifications>(); |
108 | 102 |
|
| 103 | + |
109 | 104 | // SETUP: Chainstate |
| 105 | + auto chainparams = CChainParams::Main(); |
110 | 106 | const ChainstateManager::Options chainman_opts{ |
111 | 107 | .chainparams = *chainparams, |
112 | | - .datadir = gArgs.GetDataDirNet(), |
| 108 | + .datadir = abs_datadir, |
113 | 109 | .adjusted_time_callback = NodeClock::now, |
114 | 110 | .notifications = *notifications, |
115 | 111 | }; |
116 | 112 | const node::BlockManager::Options blockman_opts{ |
117 | 113 | .chainparams = chainman_opts.chainparams, |
118 | | - .blocks_dir = gArgs.GetBlocksDirPath(), |
| 114 | + .blocks_dir = abs_datadir / "blocks", |
119 | 115 | }; |
120 | 116 | ChainstateManager chainman{chainman_opts, blockman_opts}; |
121 | 117 |
|
@@ -148,7 +144,8 @@ int main(int argc, char* argv[]) |
148 | 144 | // Main program logic starts here |
149 | 145 | std::cout |
150 | 146 | << "Hello! I'm going to print out some information about your datadir." << std::endl |
151 | | - << "\t" << "Path: " << gArgs.GetDataDirNet() << std::endl; |
| 147 | + << "\t" |
| 148 | + << "Path: " << abs_datadir << std::endl; |
152 | 149 | { |
153 | 150 | LOCK(chainman.GetMutex()); |
154 | 151 | std::cout |
|
0 commit comments