mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Constrain rpcport default values to a single location in code
This commit is contained in:
parent
6abf6eb7bb
commit
02354c93be
@ -34,7 +34,7 @@ std::string HelpMessageCli()
|
|||||||
strUsage += HelpMessageOpt("-datadir=<dir>", _("Specify data directory"));
|
strUsage += HelpMessageOpt("-datadir=<dir>", _("Specify data directory"));
|
||||||
AppendParamsHelpMessages(strUsage);
|
AppendParamsHelpMessages(strUsage);
|
||||||
strUsage += HelpMessageOpt("-rpcconnect=<ip>", strprintf(_("Send commands to node running on <ip> (default: %s)"), DEFAULT_RPCCONNECT));
|
strUsage += HelpMessageOpt("-rpcconnect=<ip>", strprintf(_("Send commands to node running on <ip> (default: %s)"), DEFAULT_RPCCONNECT));
|
||||||
strUsage += HelpMessageOpt("-rpcport=<port>", strprintf(_("Connect to JSON-RPC on <port> (default: %u or testnet: %u)"), 8332, 18332));
|
strUsage += HelpMessageOpt("-rpcport=<port>", strprintf(_("Connect to JSON-RPC on <port> (default: %u or testnet: %u)"), BaseParams(CBaseChainParams::MAIN).RPCPort(), BaseParams(CBaseChainParams::TESTNET).RPCPort()));
|
||||||
strUsage += HelpMessageOpt("-rpcwait", _("Wait for RPC server to start"));
|
strUsage += HelpMessageOpt("-rpcwait", _("Wait for RPC server to start"));
|
||||||
strUsage += HelpMessageOpt("-rpcuser=<user>", _("Username for JSON-RPC connections"));
|
strUsage += HelpMessageOpt("-rpcuser=<user>", _("Username for JSON-RPC connections"));
|
||||||
strUsage += HelpMessageOpt("-rpcpassword=<pw>", _("Password for JSON-RPC connections"));
|
strUsage += HelpMessageOpt("-rpcpassword=<pw>", _("Password for JSON-RPC connections"));
|
||||||
|
@ -86,18 +86,23 @@ const CBaseChainParams& BaseParams()
|
|||||||
return *pCurrentBaseParams;
|
return *pCurrentBaseParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectBaseParams(const std::string& chain)
|
CBaseChainParams& BaseParams(const std::string& chain)
|
||||||
{
|
{
|
||||||
if (chain == CBaseChainParams::MAIN)
|
if (chain == CBaseChainParams::MAIN)
|
||||||
pCurrentBaseParams = &mainParams;
|
return mainParams;
|
||||||
else if (chain == CBaseChainParams::TESTNET)
|
else if (chain == CBaseChainParams::TESTNET)
|
||||||
pCurrentBaseParams = &testNetParams;
|
return testNetParams;
|
||||||
else if (chain == CBaseChainParams::REGTEST)
|
else if (chain == CBaseChainParams::REGTEST)
|
||||||
pCurrentBaseParams = ®TestParams;
|
return regTestParams;
|
||||||
else
|
else
|
||||||
throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
|
throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SelectBaseParams(const std::string& chain)
|
||||||
|
{
|
||||||
|
pCurrentBaseParams = &BaseParams(chain);
|
||||||
|
}
|
||||||
|
|
||||||
std::string ChainNameFromCommandLine()
|
std::string ChainNameFromCommandLine()
|
||||||
{
|
{
|
||||||
bool fRegTest = GetBoolArg("-regtest", false);
|
bool fRegTest = GetBoolArg("-regtest", false);
|
||||||
|
@ -42,6 +42,8 @@ void AppendParamsHelpMessages(std::string& strUsage, bool debugHelp=true);
|
|||||||
*/
|
*/
|
||||||
const CBaseChainParams& BaseParams();
|
const CBaseChainParams& BaseParams();
|
||||||
|
|
||||||
|
CBaseChainParams& BaseParams(const std::string& chain);
|
||||||
|
|
||||||
/** Sets the params returned by Params() to those for the given network. */
|
/** Sets the params returned by Params() to those for the given network. */
|
||||||
void SelectBaseParams(const std::string& chain);
|
void SelectBaseParams(const std::string& chain);
|
||||||
|
|
||||||
|
@ -491,7 +491,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||||||
strUsage += HelpMessageOpt("-rpcuser=<user>", _("Username for JSON-RPC connections"));
|
strUsage += HelpMessageOpt("-rpcuser=<user>", _("Username for JSON-RPC connections"));
|
||||||
strUsage += HelpMessageOpt("-rpcpassword=<pw>", _("Password for JSON-RPC connections"));
|
strUsage += HelpMessageOpt("-rpcpassword=<pw>", _("Password for JSON-RPC connections"));
|
||||||
strUsage += HelpMessageOpt("-rpcauth=<userpw>", _("Username and hashed password for JSON-RPC connections. The field <userpw> comes in the format: <USERNAME>:<SALT>$<HASH>. A canonical python script is included in share/rpcuser. This option can be specified multiple times"));
|
strUsage += HelpMessageOpt("-rpcauth=<userpw>", _("Username and hashed password for JSON-RPC connections. The field <userpw> comes in the format: <USERNAME>:<SALT>$<HASH>. A canonical python script is included in share/rpcuser. This option can be specified multiple times"));
|
||||||
strUsage += HelpMessageOpt("-rpcport=<port>", strprintf(_("Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"), 8332, 18332));
|
strUsage += HelpMessageOpt("-rpcport=<port>", strprintf(_("Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"), BaseParams(CBaseChainParams::MAIN).RPCPort(), BaseParams(CBaseChainParams::TESTNET).RPCPort()));
|
||||||
strUsage += HelpMessageOpt("-rpcallowip=<ip>", _("Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times"));
|
strUsage += HelpMessageOpt("-rpcallowip=<ip>", _("Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times"));
|
||||||
strUsage += HelpMessageOpt("-rpcthreads=<n>", strprintf(_("Set the number of threads to service RPC calls (default: %d)"), DEFAULT_HTTP_THREADS));
|
strUsage += HelpMessageOpt("-rpcthreads=<n>", strprintf(_("Set the number of threads to service RPC calls (default: %d)"), DEFAULT_HTTP_THREADS));
|
||||||
if (showDebug) {
|
if (showDebug) {
|
||||||
|
Loading…
Reference in New Issue
Block a user