From 6ba4764d6dc0b78c2a0935db7f29375f2b8c3f37 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Mon, 29 Oct 2018 19:41:55 +0000 Subject: [PATCH 1/5] Add OptionsCategory::ELEMENTS --- src/init.cpp | 6 ++++++ src/util.cpp | 3 +++ src/util.h | 1 + 3 files changed, 10 insertions(+) diff --git a/src/init.cpp b/src/init.cpp index 6a260108820..872a7adfe1b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -523,6 +523,12 @@ void SetupServerArgs() // Add the hidden options gArgs.AddHiddenArgs(hidden_args); + + // + // Elements-specific arguments. + // + + } std::string LicenseInfo() diff --git a/src/util.cpp b/src/util.cpp index de657037593..031e95c85c2 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -631,6 +631,9 @@ std::string ArgsManager::GetHelpMessage() const case OptionsCategory::GUI: usage += HelpMessageGroup("UI Options:"); break; + case OptionsCategory::ELEMENTS: + usage += HelpMessageGroup("Elements Options:"); + break; case OptionsCategory::COMMANDS: usage += HelpMessageGroup("Commands:"); break; diff --git a/src/util.h b/src/util.h index 23b2a787e4e..be85073908c 100644 --- a/src/util.h +++ b/src/util.h @@ -130,6 +130,7 @@ enum class OptionsCategory { BLOCK_CREATION, RPC, GUI, + ELEMENTS, COMMANDS, REGISTER_COMMANDS, From 2638df8ef4e99a106d18af965374426f26bc3be0 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Tue, 30 Oct 2018 17:12:40 +0000 Subject: [PATCH 2/5] Set correct OptionsCategory for elements options --- src/init.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 872a7adfe1b..de6be969f5f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -349,7 +349,6 @@ void SetupServerArgs() // Hidden Options std::vector hidden_args = {"-rpcssl", "-benchmark", "-h", "-help", "-socks", "-tor", "-debugnet", "-whitelistalwaysrelay", "-prematurewitness", "-walletprematurewitness", "-promiscuousmempoolflags", "-blockminsize", "-dbcrashratio", "-forcecompactdb", "-usehd", - "-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", // GUI args. These will be overwritten by SetupUIArgs for the GUI "-allowselfsignedrootcertificates", "-choosedatadir", "-lang=", "-min", "-resetguisettings", "-rootcertificates=", "-splash", "-uiplatform"}; @@ -521,14 +520,23 @@ void SetupServerArgs() hidden_args.emplace_back("-daemon"); #endif - // Add the hidden options - gArgs.AddHiddenArgs(hidden_args); - // // Elements-specific arguments. // + std::vector 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"}; + + gArgs.AddArg("-pubkeyprefix", strprintf("The byte prefix, in decimal, of the chain's base58 pubkey address. (default: %d)", 235), false, OptionsCategory::ELEMENTS); + gArgs.AddArg("-scriptprefix", strprintf("The byte prefix, in decimal, of the chain's base58 script address. (default: %d)", 75), false, OptionsCategory::ELEMENTS); + gArgs.AddArg("-secretprefix", strprintf("The byte prefix, in decimal, of the chain's base58 secret key encoding. (default: %d)", 239), false, OptionsCategory::ELEMENTS); + gArgs.AddArg("-extpubkeyprefix", strprintf("The 4-byte prefix, in hex, of the chain's base58 extended public key encoding. (default: %s)", "043587CF"), false, OptionsCategory::ELEMENTS); + gArgs.AddArg("-extprvkeyprefix", strprintf("The 4-byte prefix, in hex, of the chain's base58 extended private key encoding. (default: %s)", "04358394"), false, OptionsCategory::ELEMENTS); + gArgs.AddArg("-bech32_hrp", strprintf("The human-readable part of the chain's bech32 encoding. (default: %s)", "bc"), false, OptionsCategory::ELEMENTS); + + // Add the hidden options + gArgs.AddHiddenArgs(hidden_args); + gArgs.AddHiddenArgs(elements_hidden_args); } std::string LicenseInfo() From fdf494e060b2322672e19f0b16502b55a5ec522a Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Fri, 9 Nov 2018 12:20:05 +0000 Subject: [PATCH 3/5] Also change Elements-specific chainparams --- src/chainparamsbase.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index 8db4690b415..57c1c9302ef 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -22,10 +22,10 @@ void SetupChainParamsBaseOptions() "This is intended for regression testing tools and app development.", true, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-testnet", "Use the test chain", false, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-vbparams=deployment:start:end", "Use given start/end times for specified version bits deployment (regtest or custom only)", true, OptionsCategory::CHAINPARAMS); - gArgs.AddArg("-con_mandatorycoinbase", "All non-zero valued coinbase outputs must go to this scriptPubKey, if set.", false, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-seednode=", "Use specified node as seed node. This option can be specified multiple times to connect to multiple nodes. (custom only)", true, OptionsCategory::CHAINPARAMS); - gArgs.AddArg("-con_blocksubsidy", "Defines the amount of block subsidy to start with, at genesis block.", false, OptionsCategory::CHAINPARAMS); - gArgs.AddArg("-con_connect_coinbase", "Connect outputs in genesis block to utxo database.", false, OptionsCategory::CHAINPARAMS); + gArgs.AddArg("-con_mandatorycoinbase", "All non-zero valued coinbase outputs must go to this scriptPubKey, if set.", false, OptionsCategory::ELEMENTS); + gArgs.AddArg("-con_blocksubsidy", "Defines the amount of block subsidy to start with, at genesis block.", false, OptionsCategory::ELEMENTS); + gArgs.AddArg("-con_connect_coinbase", "Connect outputs in genesis block to utxo database.", false, OptionsCategory::ELEMENTS); } static std::unique_ptr globalChainBaseParams; From 91e48e72333b5e6ffe5259347e3ab73953bc4b09 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Tue, 20 Nov 2018 11:33:02 +0000 Subject: [PATCH 4/5] Sane defaults for CHAINPARAM cli args --- src/init.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index de6be969f5f..bef1d4b3476 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -526,12 +527,12 @@ void SetupServerArgs() std::vector 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"}; - gArgs.AddArg("-pubkeyprefix", strprintf("The byte prefix, in decimal, of the chain's base58 pubkey address. (default: %d)", 235), false, OptionsCategory::ELEMENTS); - gArgs.AddArg("-scriptprefix", strprintf("The byte prefix, in decimal, of the chain's base58 script address. (default: %d)", 75), false, OptionsCategory::ELEMENTS); - gArgs.AddArg("-secretprefix", strprintf("The byte prefix, in decimal, of the chain's base58 secret key encoding. (default: %d)", 239), false, OptionsCategory::ELEMENTS); - gArgs.AddArg("-extpubkeyprefix", strprintf("The 4-byte prefix, in hex, of the chain's base58 extended public key encoding. (default: %s)", "043587CF"), false, OptionsCategory::ELEMENTS); - gArgs.AddArg("-extprvkeyprefix", strprintf("The 4-byte prefix, in hex, of the chain's base58 extended private key encoding. (default: %s)", "04358394"), false, OptionsCategory::ELEMENTS); - gArgs.AddArg("-bech32_hrp", strprintf("The human-readable part of the chain's bech32 encoding. (default: %s)", "bc"), false, OptionsCategory::ELEMENTS); + 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::ELEMENTS); + 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::ELEMENTS); + 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::ELEMENTS); + 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::ELEMENTS); + 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::ELEMENTS); + gArgs.AddArg("-bech32_hrp", strprintf("The human-readable part of the chain's bech32 encoding. (default: %s)", defaultChainParams->Bech32HRP()), false, OptionsCategory::ELEMENTS); // Add the hidden options From 2e4cb7011213e0f865d2885121e449efaf98b117 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Mon, 26 Nov 2018 12:18:05 +0000 Subject: [PATCH 5/5] Mark chain params as ::CHAINPARAMS --- src/init.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index bef1d4b3476..826e7f58dd0 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -515,6 +515,14 @@ void SetupServerArgs() gArgs.AddArg("-rpcworkqueue=", strprintf("Set the depth of the work queue to service RPC calls (default: %d)", DEFAULT_HTTP_WORKQUEUE), true, OptionsCategory::RPC); gArgs.AddArg("-server", "Accept command line and JSON-RPC commands", false, OptionsCategory::RPC); + // chain params + 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); + 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); + 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); + 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); + 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); + gArgs.AddArg("-bech32_hrp", strprintf("The human-readable part of the chain's bech32 encoding. (default: %s)", defaultChainParams->Bech32HRP()), false, OptionsCategory::CHAINPARAMS); + #if HAVE_DECL_DAEMON gArgs.AddArg("-daemon", "Run in the background as a daemon and accept commands", false, OptionsCategory::OPTIONS); #else @@ -527,13 +535,6 @@ void SetupServerArgs() std::vector 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"}; - 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::ELEMENTS); - 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::ELEMENTS); - 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::ELEMENTS); - 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::ELEMENTS); - 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::ELEMENTS); - gArgs.AddArg("-bech32_hrp", strprintf("The human-readable part of the chain's bech32 encoding. (default: %s)", defaultChainParams->Bech32HRP()), false, OptionsCategory::ELEMENTS); - // Add the hidden options gArgs.AddHiddenArgs(hidden_args);