Deduplicate list of chain strings in RPC help texts

This commit is contained in:
Martin Saposnic 2024-08-13 14:00:33 -03:00
parent 1a41e63575
commit 9b29755520
No known key found for this signature in database
GPG Key ID: 61C97B17B91BC3F8
4 changed files with 8 additions and 3 deletions

View File

@ -13,7 +13,7 @@
void SetupChainParamsBaseOptions(ArgsManager& argsman) void SetupChainParamsBaseOptions(ArgsManager& argsman)
{ {
argsman.AddArg("-chain=<chain>", "Use the chain <chain> (default: main). Allowed values: main, test, testnet4, signet, regtest", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-chain=<chain>", "Use the chain <chain> (default: main). Allowed values: " LIST_CHAIN_NAMES, ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-regtest", "Enter regression test mode, which uses a special chain in which blocks can be solved instantly. " argsman.AddArg("-regtest", "Enter regression test mode, which uses a special chain in which blocks can be solved instantly. "
"This is intended for regression testing tools and app development. Equivalent to -chain=regtest.", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); "This is intended for regression testing tools and app development. Equivalent to -chain=regtest.", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (segwit, bip34, dersig, cltv, csv). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST); argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (segwit, bip34, dersig, cltv, csv). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);

View File

@ -53,4 +53,7 @@ const CBaseChainParams& BaseParams();
/** Sets the params returned by Params() to those for the given chain. */ /** Sets the params returned by Params() to those for the given chain. */
void SelectBaseParams(const ChainType chain); void SelectBaseParams(const ChainType chain);
/** List of possible chain / network names */
#define LIST_CHAIN_NAMES "main, test, testnet4, signet, regtest"
#endif // BITCOIN_CHAINPARAMSBASE_H #endif // BITCOIN_CHAINPARAMSBASE_H

View File

@ -8,6 +8,7 @@
#include <blockfilter.h> #include <blockfilter.h>
#include <chain.h> #include <chain.h>
#include <chainparams.h> #include <chainparams.h>
#include <chainparamsbase.h>
#include <clientversion.h> #include <clientversion.h>
#include <coins.h> #include <coins.h>
#include <common/args.h> #include <common/args.h>
@ -1273,7 +1274,7 @@ RPCHelpMan getblockchaininfo()
RPCResult{ RPCResult{
RPCResult::Type::OBJ, "", "", RPCResult::Type::OBJ, "", "",
{ {
{RPCResult::Type::STR, "chain", "current network name (main, test, testnet4, signet, regtest)"}, {RPCResult::Type::STR, "chain", "current network name (" LIST_CHAIN_NAMES ")"},
{RPCResult::Type::NUM, "blocks", "the height of the most-work fully-validated chain. The genesis block has height 0"}, {RPCResult::Type::NUM, "blocks", "the height of the most-work fully-validated chain. The genesis block has height 0"},
{RPCResult::Type::NUM, "headers", "the current number of headers we have validated"}, {RPCResult::Type::NUM, "headers", "the current number of headers we have validated"},
{RPCResult::Type::STR, "bestblockhash", "the hash of the currently best block"}, {RPCResult::Type::STR, "bestblockhash", "the hash of the currently best block"},

View File

@ -7,6 +7,7 @@
#include <chain.h> #include <chain.h>
#include <chainparams.h> #include <chainparams.h>
#include <chainparamsbase.h>
#include <common/system.h> #include <common/system.h>
#include <consensus/amount.h> #include <consensus/amount.h>
#include <consensus/consensus.h> #include <consensus/consensus.h>
@ -422,7 +423,7 @@ static RPCHelpMan getmininginfo()
{RPCResult::Type::NUM, "difficulty", "The current difficulty"}, {RPCResult::Type::NUM, "difficulty", "The current difficulty"},
{RPCResult::Type::NUM, "networkhashps", "The network hashes per second"}, {RPCResult::Type::NUM, "networkhashps", "The network hashes per second"},
{RPCResult::Type::NUM, "pooledtx", "The size of the mempool"}, {RPCResult::Type::NUM, "pooledtx", "The size of the mempool"},
{RPCResult::Type::STR, "chain", "current network name (main, test, testnet4, signet, regtest)"}, {RPCResult::Type::STR, "chain", "current network name (" LIST_CHAIN_NAMES ")"},
(IsDeprecatedRPCEnabled("warnings") ? (IsDeprecatedRPCEnabled("warnings") ?
RPCResult{RPCResult::Type::STR, "warnings", "any network and blockchain warnings (DEPRECATED)"} : RPCResult{RPCResult::Type::STR, "warnings", "any network and blockchain warnings (DEPRECATED)"} :
RPCResult{RPCResult::Type::ARR, "warnings", "any network and blockchain warnings (run with `-deprecatedrpc=warnings` to return the latest warning as a single string)", RPCResult{RPCResult::Type::ARR, "warnings", "any network and blockchain warnings (run with `-deprecatedrpc=warnings` to return the latest warning as a single string)",