aboutsummaryrefslogtreecommitdiff
path: root/src/chainparams.h
diff options
context:
space:
mode:
authorTheCharlatan <seb.kung@gmail.com>2023-04-17 22:20:59 +0200
committerTheCharlatan <seb.kung@gmail.com>2023-05-09 15:49:14 +0200
commitba8fc7d788932b25864fb260ca14983aa2398c23 (patch)
tree3049d9b5282c243faf7e0ab1e7d2a7ee17937a36 /src/chainparams.h
parent401453df419af35957ec711423ac3d93ad512fe8 (diff)
downloadbitcoin-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.h5
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