|
20 | 20 | #include <rpc/request.h> |
21 | 21 | #include <tinyformat.h> |
22 | 22 | #include <univalue.h> |
| 23 | +#include <util/chaintype.h> |
23 | 24 | #include <util/exception.h> |
24 | 25 | #include <util/strencodings.h> |
25 | 26 | #include <util/system.h> |
@@ -73,10 +74,10 @@ static void SetupCliArgs(ArgsManager& argsman) |
73 | 74 | { |
74 | 75 | SetupHelpOptions(argsman); |
75 | 76 |
|
76 | | - const auto defaultBaseParams = CreateBaseChainParams(CBaseChainParams::MAIN); |
77 | | - const auto testnetBaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET); |
78 | | - const auto signetBaseParams = CreateBaseChainParams(CBaseChainParams::SIGNET); |
79 | | - const auto regtestBaseParams = CreateBaseChainParams(CBaseChainParams::REGTEST); |
| 77 | + const auto defaultBaseParams = CreateBaseChainParams(ChainType::MAIN); |
| 78 | + const auto testnetBaseParams = CreateBaseChainParams(ChainType::TESTNET); |
| 79 | + const auto signetBaseParams = CreateBaseChainParams(ChainType::SIGNET); |
| 80 | + const auto regtestBaseParams = CreateBaseChainParams(ChainType::REGTEST); |
80 | 81 |
|
81 | 82 | argsman.AddArg("-version", "Print version and exit", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); |
82 | 83 | argsman.AddArg("-conf=<file>", strprintf("Specify configuration file. Relative paths will be prefixed by datadir location. (default: %s)", BITCOIN_CONF_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); |
@@ -174,7 +175,7 @@ static int AppInitRPC(int argc, char* argv[]) |
174 | 175 | } |
175 | 176 | // Check for chain settings (BaseParams() calls are only valid after this clause) |
176 | 177 | try { |
177 | | - SelectBaseParams(gArgs.GetChainName()); |
| 178 | + SelectBaseParams(gArgs.GetChainType()); |
178 | 179 | } catch (const std::exception& e) { |
179 | 180 | tfm::format(std::cerr, "Error: %s\n", e.what()); |
180 | 181 | return EXIT_FAILURE; |
@@ -426,10 +427,16 @@ class NetinfoRequestHandler : public BaseRequestHandler |
426 | 427 | std::vector<Peer> m_peers; |
427 | 428 | std::string ChainToString() const |
428 | 429 | { |
429 | | - if (gArgs.GetChainName() == CBaseChainParams::TESTNET) return " testnet"; |
430 | | - if (gArgs.GetChainName() == CBaseChainParams::SIGNET) return " signet"; |
431 | | - if (gArgs.GetChainName() == CBaseChainParams::REGTEST) return " regtest"; |
432 | | - return ""; |
| 430 | + switch (gArgs.GetChainType()) { |
| 431 | + case ChainType::TESTNET: |
| 432 | + return " testnet"; |
| 433 | + case ChainType::SIGNET: |
| 434 | + return " signet"; |
| 435 | + case ChainType::REGTEST: |
| 436 | + return " regtest"; |
| 437 | + default: |
| 438 | + return ""; |
| 439 | + } |
433 | 440 | } |
434 | 441 | std::string PingTimeToString(double seconds) const |
435 | 442 | { |
|
0 commit comments