Skip to content

Commit 823b909

Browse files
committed
Merge #453: [0.17] Add OptionsCategory::ELEMENTS
2e4cb70 Mark chain params as ::CHAINPARAMS (Steven Roose) 91e48e7 Sane defaults for CHAINPARAM cli args (Steven Roose) fdf494e Also change Elements-specific chainparams (Steven Roose) 2638df8 Set correct OptionsCategory for elements options (Steven Roose) 6ba4764 Add OptionsCategory::ELEMENTS (Steven Roose) Pull request description: Attempt to group elements-specific -options together. Tree-SHA512: 3cc669c55f657b9d20c4bc2d67d222b73649b916b45f127858f3ca20210f5589a44a0dac508d47007b7f628fc4108f5ee3011a658ff269c47b722270404a4c4f
2 parents 609323f + 2e4cb70 commit 823b909

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

src/chainparamsbase.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ void SetupChainParamsBaseOptions()
2222
"This is intended for regression testing tools and app development.", true, OptionsCategory::CHAINPARAMS);
2323
gArgs.AddArg("-testnet", "Use the test chain", false, OptionsCategory::CHAINPARAMS);
2424
gArgs.AddArg("-vbparams=deployment:start:end", "Use given start/end times for specified version bits deployment (regtest or custom only)", true, OptionsCategory::CHAINPARAMS);
25-
gArgs.AddArg("-con_mandatorycoinbase", "All non-zero valued coinbase outputs must go to this scriptPubKey, if set.", false, OptionsCategory::CHAINPARAMS);
2625
gArgs.AddArg("-seednode=<ip>", "Use specified node as seed node. This option can be specified multiple times to connect to multiple nodes. (custom only)", true, OptionsCategory::CHAINPARAMS);
27-
gArgs.AddArg("-con_blocksubsidy", "Defines the amount of block subsidy to start with, at genesis block.", false, OptionsCategory::CHAINPARAMS);
28-
gArgs.AddArg("-con_connect_coinbase", "Connect outputs in genesis block to utxo database.", false, OptionsCategory::CHAINPARAMS);
26+
gArgs.AddArg("-con_mandatorycoinbase", "All non-zero valued coinbase outputs must go to this scriptPubKey, if set.", false, OptionsCategory::ELEMENTS);
27+
gArgs.AddArg("-con_blocksubsidy", "Defines the amount of block subsidy to start with, at genesis block.", false, OptionsCategory::ELEMENTS);
28+
gArgs.AddArg("-con_connect_coinbase", "Connect outputs in genesis block to utxo database.", false, OptionsCategory::ELEMENTS);
2929
}
3030

3131
static std::unique_ptr<CBaseChainParams> globalChainBaseParams;

src/init.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include <ui_interface.h>
4444
#include <util.h>
4545
#include <utilmoneystr.h>
46+
#include <utilstrencodings.h>
4647
#include <validationinterface.h>
4748
#include <warnings.h>
4849
#include <walletinitinterface.h>
@@ -349,7 +350,6 @@ void SetupServerArgs()
349350
// Hidden Options
350351
std::vector<std::string> hidden_args = {"-rpcssl", "-benchmark", "-h", "-help", "-socks", "-tor", "-debugnet", "-whitelistalwaysrelay",
351352
"-prematurewitness", "-walletprematurewitness", "-promiscuousmempoolflags", "-blockminsize", "-dbcrashratio", "-forcecompactdb", "-usehd",
352-
"-con_fpowallowmindifficultyblocks", "-con_fpownoretargeting", "-con_nsubsidyhalvinginterval", "-con_bip16exception", "-con_bip34height", "-con_bip65height", "-con_bip66height", "-con_npowtargettimespan", "-con_npowtargetspacing", "-con_nrulechangeactivationthreshold", "-con_nminerconfirmationwindow", "-con_powlimit", "-con_bip34hash", "-con_nminimumchainwork", "-con_defaultassumevalid", "-npruneafterheight", "-fdefaultconsistencychecks", "-fmineblocksondemand", "-bech32_hrp", "-fallback_fee_enabled", "-pubkeyprefix", "-scriptprefix", "-secretprefix", "-extpubkeyprefix", "-extprvkeyprefix", "-pchmessagestart",
353353
// GUI args. These will be overwritten by SetupUIArgs for the GUI
354354
"-allowselfsignedrootcertificates", "-choosedatadir", "-lang=<lang>", "-min", "-resetguisettings", "-rootcertificates=<file>", "-splash", "-uiplatform"};
355355

@@ -516,14 +516,30 @@ void SetupServerArgs()
516516
gArgs.AddArg("-rpcworkqueue=<n>", strprintf("Set the depth of the work queue to service RPC calls (default: %d)", DEFAULT_HTTP_WORKQUEUE), true, OptionsCategory::RPC);
517517
gArgs.AddArg("-server", "Accept command line and JSON-RPC commands", false, OptionsCategory::RPC);
518518

519+
// chain params
520+
gArgs.AddArg("-pubkeyprefix", strprintf("The byte prefix, in decimal, of the chain's base58 pubkey address. (default: %d)", defaultChainParams->Base58Prefix(CChainParams::PUBKEY_ADDRESS)[0]), false, OptionsCategory::CHAINPARAMS);
521+
gArgs.AddArg("-scriptprefix", strprintf("The byte prefix, in decimal, of the chain's base58 script address. (default: %d)", defaultChainParams->Base58Prefix(CChainParams::SCRIPT_ADDRESS)[0]), false, OptionsCategory::CHAINPARAMS);
522+
gArgs.AddArg("-secretprefix", strprintf("The byte prefix, in decimal, of the chain's base58 secret key encoding. (default: %d)", defaultChainParams->Base58Prefix(CChainParams::SECRET_KEY)[0]), false, OptionsCategory::CHAINPARAMS);
523+
gArgs.AddArg("-extpubkeyprefix", strprintf("The 4-byte prefix, in hex, of the chain's base58 extended public key encoding. (default: %s)", HexStr(defaultChainParams->Base58Prefix(CChainParams::EXT_PUBLIC_KEY))), false, OptionsCategory::CHAINPARAMS);
524+
gArgs.AddArg("-extprvkeyprefix", strprintf("The 4-byte prefix, in hex, of the chain's base58 extended private key encoding. (default: %s)", HexStr(defaultChainParams->Base58Prefix(CChainParams::EXT_SECRET_KEY))), false, OptionsCategory::CHAINPARAMS);
525+
gArgs.AddArg("-bech32_hrp", strprintf("The human-readable part of the chain's bech32 encoding. (default: %s)", defaultChainParams->Bech32HRP()), false, OptionsCategory::CHAINPARAMS);
526+
519527
#if HAVE_DECL_DAEMON
520528
gArgs.AddArg("-daemon", "Run in the background as a daemon and accept commands", false, OptionsCategory::OPTIONS);
521529
#else
522530
hidden_args.emplace_back("-daemon");
523531
#endif
524532

533+
//
534+
// Elements-specific arguments.
535+
//
536+
537+
std::vector<std::string> elements_hidden_args = {"-con_fpowallowmindifficultyblocks", "-con_fpownoretargeting", "-con_nsubsidyhalvinginterval", "-con_bip16exception", "-con_bip34height", "-con_bip65height", "-con_bip66height", "-con_npowtargettimespan", "-con_npowtargetspacing", "-con_nrulechangeactivationthreshold", "-con_nminerconfirmationwindow", "-con_powlimit", "-con_bip34hash", "-con_nminimumchainwork", "-con_defaultassumevalid", "-npruneafterheight", "-fdefaultconsistencychecks", "-fmineblocksondemand", "-fallback_fee_enabled", "-pchmessagestart"};
538+
539+
525540
// Add the hidden options
526541
gArgs.AddHiddenArgs(hidden_args);
542+
gArgs.AddHiddenArgs(elements_hidden_args);
527543
}
528544

529545
std::string LicenseInfo()

src/util.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,9 @@ std::string ArgsManager::GetHelpMessage() const
631631
case OptionsCategory::GUI:
632632
usage += HelpMessageGroup("UI Options:");
633633
break;
634+
case OptionsCategory::ELEMENTS:
635+
usage += HelpMessageGroup("Elements Options:");
636+
break;
634637
case OptionsCategory::COMMANDS:
635638
usage += HelpMessageGroup("Commands:");
636639
break;

src/util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ enum class OptionsCategory {
130130
BLOCK_CREATION,
131131
RPC,
132132
GUI,
133+
ELEMENTS,
133134
COMMANDS,
134135
REGISTER_COMMANDS,
135136

0 commit comments

Comments
 (0)