diff options
author | TheCharlatan <seb.kung@gmail.com> | 2023-04-17 22:20:59 +0200 |
---|---|---|
committer | TheCharlatan <seb.kung@gmail.com> | 2023-05-09 15:49:14 +0200 |
commit | ba8fc7d788932b25864fb260ca14983aa2398c23 (patch) | |
tree | 3049d9b5282c243faf7e0ab1e7d2a7ee17937a36 /src/chainparams.h | |
parent | 401453df419af35957ec711423ac3d93ad512fe8 (diff) | |
download | bitcoin-ba8fc7d788932b25864fb260ca14983aa2398c23.tar.xz |
refactor: Replace string chain name constants with ChainTypes
This commit effectively moves the definition of these constants
out of the chainparamsbase to their own file.
Using the ChainType enums provides better type safety compared to
passing around strings.
The commit is part of an ongoing effort to decouple the libbitcoinkernel
library from the ArgsManager and other functionality that should not be
part of the kernel library.
Diffstat (limited to 'src/chainparams.h')
-rw-r--r-- | src/chainparams.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/chainparams.h b/src/chainparams.h index cb34d068e1..52f001c096 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -13,6 +13,7 @@ #include <netaddress.h> #include <primitives/block.h> #include <protocol.h> +#include <util/chaintype.h> #include <util/hash_type.h> #include <cstdint> @@ -26,7 +27,7 @@ * @returns a CChainParams* of the chosen chain. * @throws a std::runtime_error if the chain is not supported. */ -std::unique_ptr<const CChainParams> CreateChainParams(const ArgsManager& args, const std::string& chain); +std::unique_ptr<const CChainParams> CreateChainParams(const ArgsManager& args, const ChainType chain); /** * Return the currently selected parameters. This won't change after app @@ -38,6 +39,6 @@ const CChainParams &Params(); * Sets the params returned by Params() to those for the given chain name. * @throws std::runtime_error when the chain is not supported. */ -void SelectParams(const std::string& chain); +void SelectParams(const ChainType chain); #endif // BITCOIN_CHAINPARAMS_H |