diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 2136b45a2a..b7af7422d0 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -427,16 +427,26 @@ private: std::vector m_peers; std::string ChainToString() const { - switch (gArgs.GetChainType()) { + const ChainTypeMeta chain = gArgs.GetChainTypeMeta(); // ELEMENTS + switch (chain.chain_type) { case ChainType::TESTNET: return " testnet"; case ChainType::SIGNET: return " signet"; case ChainType::REGTEST: return " regtest"; - default: + case ChainType::MAIN: return ""; + case ChainType::LIQUID1: + return "liquidv1"; + case ChainType::LIQUID1TEST: + return "liquidv1test"; + case ChainType::LIQUIDTESTNET: + return "liquidtestnet"; + case ChainType::CUSTOM: + return chain.chain_name; } + assert(false); } std::string PingTimeToString(double seconds) const { diff --git a/src/chainparams.h b/src/chainparams.h index 65b7cfb835..4687467ec2 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -25,8 +25,6 @@ class ArgsManager; /** * Creates and returns a std::unique_ptr of the chosen chain. - * @returns a CChainParams* of the chosen chain. - * @throws a std::runtime_error if the chain is not supported. */ std::unique_ptr CreateChainParams(const ArgsManager& args, const ChainType chain); @@ -37,8 +35,7 @@ std::unique_ptr CreateChainParams(const ArgsManager& args, c 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. + * Sets the params returned by Params() to those for the given chain type. */ void SelectParams(const ChainType chain); diff --git a/src/chainparamsbase.h b/src/chainparamsbase.h index 7c747d6381..6aaf63733c 100644 --- a/src/chainparamsbase.h +++ b/src/chainparamsbase.h @@ -38,8 +38,6 @@ private: /** * Creates and returns a std::unique_ptr of the chosen chain. - * @returns a CBaseChainParams* of the chosen chain. - * @throws a std::runtime_error if the chain is not supported. */ std::unique_ptr CreateBaseChainParams(const ChainType chain); diff --git a/src/common/args.h b/src/common/args.h index cd2128f333..3650d5f760 100644 --- a/src/common/args.h +++ b/src/common/args.h @@ -322,14 +322,14 @@ protected: void ForceSetArg(const std::string& strArg, const std::string& strValue); /** - * Returns the appropriate chain name from the program arguments. + * Returns the appropriate chain type from the program arguments. * @return ChainType::MAIN by default; raises runtime error if an invalid * combination, or unknown chain is given. */ ChainType GetChainType() const; /** - * Returns the appropriate chain name string from the program arguments. + * Returns the appropriate chain type string from the program arguments. * @return ChainType::MAIN string by default; raises runtime error if an * invalid combination is given. */ @@ -425,7 +425,7 @@ private: /** * Return -regtest/-signet/-testnet/-chain= setting as a ChainType enum if a - * recognized chain name was set, or as a string if an unrecognized chain + * recognized chain type was set, or as a string if an unrecognized chain * name was set. Raise an exception if an invalid combination of flags was * provided. */ diff --git a/src/test/argsman_tests.cpp b/src/test/argsman_tests.cpp index edca4bfcc8..e349ed5b73 100644 --- a/src/test/argsman_tests.cpp +++ b/src/test/argsman_tests.cpp @@ -255,7 +255,7 @@ BOOST_AUTO_TEST_CASE(util_ParseInvalidParameters) BOOST_CHECK(!test.ParseParameters(2, (char**)argv, error)); BOOST_CHECK_EQUAL(error, "Invalid parameter -unregistered"); - // Make sure registered parameters prefixed with a chain name trigger errors. + // Make sure registered parameters prefixed with a chain type trigger errors. // (Previously, they were accepted and ignored.) argv[1] = "-test.registered"; BOOST_CHECK(!test.ParseParameters(2, (char**)argv, error));