mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
Merge bitcoin/bitcoin#26177: refactor / kernel: Move non-gArgs chainparams functionality to kernel
b3e78dc91drefactor: Don't use global chainparams in chainstatemanager method (TheCharlatan)382b692a50Split non/kernel chainparams (Carl Dong)edabbc78a3Add factory functions for Main/Test/Sig/Reg chainparams (Carl Dong)d938098398Remove UpdateVersionBitsParameters (Carl Dong)84b85786f0Decouple RegTestChainParams from ArgsManager (Carl Dong)76cd4e7c96Decouple SigNetChainParams from ArgsManager (Carl Dong) Pull request description: This pull request is part of the `libbitcoinkernel` project https://github.com/bitcoin/bitcoin/issues/24303 https://github.com/bitcoin/bitcoin/projects/18 and more specifically its "Step 2: Decouple most non-consensus code from libbitcoinkernel". dongcarl is the original author of this patchset, these commits were taken from https://github.com/dongcarl/bitcoin/tree/2022-03-libbitcoinkernel-chainparams-args-only. #### Context The bitcoin kernel library currently relies on code containing user configurations through the `ArgsManager`. This is not optimal, since as a stand-alone library it should not rely on bitcoind's argument parsing logic. Instead, its interfaces should accept control and options structs that control the kernel library's desired configuration. Similar work towards decoupling the `ArgsManager` from the kernel has been done in https://github.com/bitcoin/bitcoin/pull/25290, https://github.com/bitcoin/bitcoin/pull/25487, https://github.com/bitcoin/bitcoin/pull/25527 and https://github.com/bitcoin/bitcoin/pull/25862. #### Changes By moving the `CChainParams` class definition into the kernel and giving it new factory functions `CChainParams::{RegTest,SigNet,Main,TestNet}`it can be constructed without an `ArgsManager` reference, unlike the current factory function `CreateChainParams`. The first few commits remove uses of `ArgsManager` within `CChainParams`. Then the `CChainParams` definition is moved to a new file in the `kernel/` subdirectory. ACKs for top commit: MarcoFalke: re-ACKb3e78dc91d🛁 ryanofsky: Code review ACKb3e78dc91d. Only changes since last review were recent review suggestions. ajtowns: ACKb3e78dc91dTree-SHA512: 3835aca1d3e3c75cc3303dd584bab3a77e58f6c678724a5e359fe4b0e17e0763a00931ee6191f516b9fde50496f59cc691f0709c0254206db3863bbf7ab2cacd
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
//
|
||||
// It is part of the libbitcoinkernel project.
|
||||
|
||||
#include <kernel/chainparams.h>
|
||||
#include <kernel/checks.h>
|
||||
#include <kernel/context.h>
|
||||
#include <kernel/validation_cache_sizes.h>
|
||||
@@ -52,7 +53,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
// SETUP: Misc Globals
|
||||
SelectParams(CBaseChainParams::MAIN);
|
||||
const CChainParams& chainparams = Params();
|
||||
auto chainparams = CChainParams::Main();
|
||||
|
||||
kernel::Context kernel_context{};
|
||||
// We can't use a goto here, but we can use an assert since none of the
|
||||
@@ -81,7 +82,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
// SETUP: Chainstate
|
||||
const ChainstateManager::Options chainman_opts{
|
||||
.chainparams = chainparams,
|
||||
.chainparams = *chainparams,
|
||||
.datadir = gArgs.GetDataDirNet(),
|
||||
.adjusted_time_callback = NodeClock::now,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user