HomePhabricator

Decouple ChainParams from ArgsManager, add factory functions

Description

Decouple ChainParams from ArgsManager, add factory functions

Summary:
Chain params can now be initialized by configuring a ChainOptions struct. This offers an interface for
creating ChainParams without a gArgs object.

The factory functions can also easily be used from a context without an instantiated ArgsManager, e.g. from libbitcoin kernel code, unlike the existing CreateChainParams method.

Inspired by:
https://github.com/bitcoin/bitcoin/pull/13311/commits/6fa901fb4726ddac025d5396ecf09d047a8aa9a1 (make globalChainParams const)
https://github.com/bitcoin/bitcoin/pull/20004/commits/fa23308e9aad70c99a31f91d8556f1876ea02c04 (Remove gArgs global from CreateChainParams)
https://github.com/bitcoin/bitcoin/pull/26177/commits/84b85786f0f5cb23cc257a4464ae345e1d372313 (Decouple ChainParams from ArgsManager)
https://github.com/bitcoin/bitcoin/pull/26177/commits/edabbc78a3bc272b2b802e1dbab73d6ed8e31e96 (Add factory functions for Main/Test/Reg chainparams)

The main difference with the source material is that we need the ArgsManager for all chains, because of the -ecash arg.

Test Plan: ninja all check-all bitcoin-fuzzers

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D16114

Details

Provenance
PiRKAuthored on May 3 2024, 16:12
PiRKPushed on May 6 2024, 14:14
Reviewer
Restricted Project
Differential Revision
D16114: Decouple ChainParams from ArgsManager, add factory functions
Parents
rABC7eb1a738fe5d: move DummyConfig to test/util/setup_common.h
Branches
Unknown
Tags
Unknown