Changeset View
Changeset View
Standalone View
Standalone View
src/bitcoin-cli.cpp
Show All 34 Lines | |||||
static void SetupCliArgs() { | static void SetupCliArgs() { | ||||
const auto defaultBaseParams = | const auto defaultBaseParams = | ||||
CreateBaseChainParams(CBaseChainParams::MAIN); | CreateBaseChainParams(CBaseChainParams::MAIN); | ||||
const auto testnetBaseParams = | const auto testnetBaseParams = | ||||
CreateBaseChainParams(CBaseChainParams::TESTNET); | CreateBaseChainParams(CBaseChainParams::TESTNET); | ||||
const auto regtestBaseParams = | const auto regtestBaseParams = | ||||
CreateBaseChainParams(CBaseChainParams::REGTEST); | CreateBaseChainParams(CBaseChainParams::REGTEST); | ||||
gArgs.AddArg("-?", "This help message", false, OptionsCategory::OPTIONS); | gArgs.AddArg("-?", "This help message", ArgsManager::ALLOW_ANY, false, | ||||
gArgs.AddArg("-version", "Print version and exit", false, | |||||
OptionsCategory::OPTIONS); | OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-version", "Print version and exit", ArgsManager::ALLOW_ANY, | |||||
false, OptionsCategory::OPTIONS); | |||||
gArgs.AddArg("-conf=<file>", | gArgs.AddArg("-conf=<file>", | ||||
strprintf("Specify configuration file. Relative paths will be " | strprintf("Specify configuration file. Relative paths will be " | ||||
"prefixed by datadir location. (default: %s)", | "prefixed by datadir location. (default: %s)", | ||||
BITCOIN_CONF_FILENAME), | BITCOIN_CONF_FILENAME), | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-datadir=<dir>", _("Specify data directory"), false, | gArgs.AddArg("-datadir=<dir>", _("Specify data directory"), | ||||
OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-getinfo", | "-getinfo", | ||||
"Get general information from the remote server. Note that unlike " | "Get general information from the remote server. Note that unlike " | ||||
"server-side RPC calls, the results of -getinfo is the result of " | "server-side RPC calls, the results of -getinfo is the result of " | ||||
"multiple non-atomic requests. Some entries in the result may " | "multiple non-atomic requests. Some entries in the result may " | ||||
"represent results from different states (e.g. wallet balance may be " | "represent results from different states (e.g. wallet balance may be " | ||||
"as of a different block from the chain state reported)", | "as of a different block from the chain state reported)", | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
SetupChainParamsBaseOptions(); | SetupChainParamsBaseOptions(); | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-named", | "-named", | ||||
strprintf("Pass named instead of positional arguments (default: %s)", | strprintf("Pass named instead of positional arguments (default: %s)", | ||||
DEFAULT_NAMED), | DEFAULT_NAMED), | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-rpcconnect=<ip>", | "-rpcconnect=<ip>", | ||||
strprintf("Send commands to node running on <ip> (default: %s)", | strprintf("Send commands to node running on <ip> (default: %s)", | ||||
DEFAULT_RPCCONNECT), | DEFAULT_RPCCONNECT), | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-rpccookiefile=<loc>", | gArgs.AddArg("-rpccookiefile=<loc>", | ||||
"Location of the auth cookie. Relative paths will be prefixed " | "Location of the auth cookie. Relative paths will be prefixed " | ||||
"by a net-specific datadir location. (default: data dir)", | "by a net-specific datadir location. (default: data dir)", | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-rpcport=<port>", | gArgs.AddArg("-rpcport=<port>", | ||||
strprintf("Connect to JSON-RPC on <port> (default: %u, " | strprintf("Connect to JSON-RPC on <port> (default: %u, " | ||||
"testnet: %u, regtest: %u)", | "testnet: %u, regtest: %u)", | ||||
defaultBaseParams->RPCPort(), | defaultBaseParams->RPCPort(), | ||||
testnetBaseParams->RPCPort(), | testnetBaseParams->RPCPort(), | ||||
regtestBaseParams->RPCPort()), | regtestBaseParams->RPCPort()), | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-rpcwait", "Wait for RPC server to start", false, | gArgs.AddArg("-rpcwait", "Wait for RPC server to start", | ||||
OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-rpcuser=<user>", "Username for JSON-RPC connections", false, | gArgs.AddArg("-rpcuser=<user>", "Username for JSON-RPC connections", | ||||
OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-rpcpassword=<pw>", "Password for JSON-RPC connections", | gArgs.AddArg("-rpcpassword=<pw>", "Password for JSON-RPC connections", | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-rpcclienttimeout=<n>", | gArgs.AddArg("-rpcclienttimeout=<n>", | ||||
strprintf("Timeout in seconds during HTTP requests, or 0 for " | strprintf("Timeout in seconds during HTTP requests, or 0 for " | ||||
"no timeout. (default: %d)", | "no timeout. (default: %d)", | ||||
DEFAULT_HTTP_CLIENT_TIMEOUT), | DEFAULT_HTTP_CLIENT_TIMEOUT), | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-stdinrpcpass", | gArgs.AddArg("-stdinrpcpass", | ||||
strprintf("Read RPC password from standard input as a single " | strprintf("Read RPC password from standard input as a single " | ||||
"line. When combined with -stdin, the first line " | "line. When combined with -stdin, the first line " | ||||
"from standard input is used for the RPC password."), | "from standard input is used for the RPC password."), | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-stdin", | gArgs.AddArg("-stdin", | ||||
"Read extra arguments from standard input, one per line until " | "Read extra arguments from standard input, one per line until " | ||||
"EOF/Ctrl-D (recommended for sensitive information such as " | "EOF/Ctrl-D (recommended for sensitive information such as " | ||||
"passphrases)", | "passphrases)", | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-rpcwallet=<walletname>", | "-rpcwallet=<walletname>", | ||||
"Send RPC for non-default wallet on RPC server (needs to exactly match " | "Send RPC for non-default wallet on RPC server (needs to exactly match " | ||||
"corresponding -wallet option passed to bitcoind)", | "corresponding -wallet option passed to bitcoind)", | ||||
false, OptionsCategory::OPTIONS); | ArgsManager::ALLOW_ANY, false, OptionsCategory::OPTIONS); | ||||
// Hidden | // Hidden | ||||
gArgs.AddArg("-h", "", false, OptionsCategory::HIDDEN); | gArgs.AddArg("-h", "", ArgsManager::ALLOW_ANY, false, | ||||
gArgs.AddArg("-help", "", false, OptionsCategory::HIDDEN); | OptionsCategory::HIDDEN); | ||||
gArgs.AddArg("-help", "", ArgsManager::ALLOW_ANY, false, | |||||
OptionsCategory::HIDDEN); | |||||
} | } | ||||
/** libevent event log callback */ | /** libevent event log callback */ | ||||
static void libevent_log_cb(int severity, const char *msg) { | static void libevent_log_cb(int severity, const char *msg) { | ||||
#ifndef EVENT_LOG_ERR | #ifndef EVENT_LOG_ERR | ||||
// EVENT_LOG_ERR was added in 2.0.19; but before then _EVENT_LOG_ERR existed. | // EVENT_LOG_ERR was added in 2.0.19; but before then _EVENT_LOG_ERR existed. | ||||
#define EVENT_LOG_ERR _EVENT_LOG_ERR | #define EVENT_LOG_ERR _EVENT_LOG_ERR | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 539 Lines • Show Last 20 Lines |