Skip to content

Commit c2dae5d

Browse files
committed
kernel: Remove chainparams, chainparamsbase, args, settings from kernel library
1 parent 05870b1 commit c2dae5d

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

src/Makefile.am

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -912,12 +912,8 @@ libbitcoinkernel_la_SOURCES = \
912912
kernel/bitcoinkernel.cpp \
913913
arith_uint256.cpp \
914914
chain.cpp \
915-
chainparamsbase.cpp \
916-
chainparams.cpp \
917915
clientversion.cpp \
918916
coins.cpp \
919-
common/args.cpp \
920-
common/config.cpp \
921917
compressor.cpp \
922918
consensus/merkle.cpp \
923919
consensus/tx_check.cpp \
@@ -978,7 +974,6 @@ libbitcoinkernel_la_SOURCES = \
978974
util/moneystr.cpp \
979975
util/rbf.cpp \
980976
util/serfloat.cpp \
981-
util/settings.cpp \
982977
util/strencodings.cpp \
983978
util/string.cpp \
984979
util/syscall_sandbox.cpp \

src/bitcoin-chainstate.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#include <kernel/context.h>
1818
#include <kernel/validation_cache_sizes.h>
1919

20-
#include <chainparams.h>
21-
#include <common/args.h>
2220
#include <consensus/validation.h>
2321
#include <core_io.h>
2422
#include <node/blockstorage.h>
@@ -53,13 +51,9 @@ int main(int argc, char* argv[])
5351
}
5452
std::filesystem::path abs_datadir = std::filesystem::absolute(argv[1]);
5553
std::filesystem::create_directories(abs_datadir);
56-
gArgs.ForceSetArg("-datadir", abs_datadir.string());
5754

5855

59-
// SETUP: Misc Globals
60-
SelectParams(ChainType::MAIN);
61-
auto chainparams = CChainParams::Main();
62-
56+
// SETUP: Context
6357
kernel::Context kernel_context{};
6458
// We can't use a goto here, but we can use an assert since none of the
6559
// things instantiated so far requires running the epilogue to be torn down
@@ -106,16 +100,18 @@ int main(int argc, char* argv[])
106100
};
107101
auto notifications = std::make_unique<KernelNotifications>();
108102

103+
109104
// SETUP: Chainstate
105+
auto chainparams = CChainParams::Main();
110106
const ChainstateManager::Options chainman_opts{
111107
.chainparams = *chainparams,
112-
.datadir = gArgs.GetDataDirNet(),
108+
.datadir = abs_datadir,
113109
.adjusted_time_callback = NodeClock::now,
114110
.notifications = *notifications,
115111
};
116112
const node::BlockManager::Options blockman_opts{
117113
.chainparams = chainman_opts.chainparams,
118-
.blocks_dir = gArgs.GetBlocksDirPath(),
114+
.blocks_dir = abs_datadir / "blocks",
119115
};
120116
ChainstateManager chainman{chainman_opts, blockman_opts};
121117

@@ -148,7 +144,8 @@ int main(int argc, char* argv[])
148144
// Main program logic starts here
149145
std::cout
150146
<< "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;
152149
{
153150
LOCK(chainman.GetMutex());
154151
std::cout

0 commit comments

Comments
 (0)