This pull request is part of the libbitcoinkernel
project #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
#25290, #25487, #25527 and #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.