Skip to content

Commit

Permalink
Add missing args from thorough review of code
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescowens committed May 30, 2021
1 parent 9cf6536 commit f1fc84f
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 80 deletions.
104 changes: 86 additions & 18 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "ui_interface.h"
#include "scheduler.h"
#include "gridcoin/gridcoin.h"
#include "miner.h"

#include <boost/algorithm/string/predicate.hpp>
#include <openssl/crypto.h>
Expand Down Expand Up @@ -242,8 +243,14 @@ void AddLoggingArgs(ArgsManager& argsman)
ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-logarchivedaily", "Archive log file to compressed archive daily (default: 1)",
ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-deleteoldlogarchives", "Delete oldest log archive files in excess of -logarchiveretainnumfiles "
"setting",
ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-logarchiveretainnumfiles", "Specify number of compressed log archive files to retain (default: 30)",
ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-org=<string>", "Set organization name for identification (default: not set). Required for use "
"on testnet. Do not set this for a wallet on mainnet.",
ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
}

void SetupServerArgs()
Expand All @@ -265,7 +272,7 @@ void SetupServerArgs()
std::vector<std::string> hidden_args = {
"-dbcrashratio", "-forcecompactdb",
// GUI args. These will be overwritten by SetupUIArgs for the GUI
"-choosedatadir", "-lang=<lang>", "-min", "-resetguisettings", "-splash", "-uiplatform"};
"-choosedatadir", "-lang=<lang>", "-min", "-resetguisettings", "-splash", "-style", "-suppressnetworkgraph"};

// Listed Options
// General
Expand All @@ -289,6 +296,8 @@ void SetupServerArgs()
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-paytxfee=<amt>", "Fee per KB to add to transactions you send",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-mintxfee=<amt>", "Minimum transaction fee for transactions you send or process (default: 0.001 GRC)",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-mininput=<amt>", "When creating transactions, ignore inputs with value less than this (default: 0.01)",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-showorphans", "Include stale (orphaned) coinstake transactions in the transaction list",
Expand All @@ -310,22 +319,11 @@ void SetupServerArgs()
argsman.AddArg("-blockminsize=<n>", "Set minimum block size in bytes (default: 0)",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
// TODO: Check the maximize block size default.
argsman.AddArg("-blockmaxsize=<n>", "Set maximum block size in bytes (default: 250000)",
argsman.AddArg("-blockmaxsize=<n>", strprintf("Set maximum block size in bytes (default: %u)", MAX_BLOCK_SIZE_GEN/2),
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-blockprioritysize=<n>", "Set maximum size of high-priority/low-fee transactions in bytes"
" (default: 27000)",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-email=<email>", "Email address to use for CPID detection. Must match your BOINC account email",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-boincdatadir=<path>", "Path to the BOINC data directory for CPID detection when the BOINC client uses"
" a non-default directory",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-forcecpid=<cpid>", "Override automatic CPID detection with the specified CPID",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-investor", "Disable CPID detection and do not participate in the research reward system",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-pooloperator", "Skip pool CPID checks for staking nodes run by pool administrators",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-snapshotdownload", "Download and apply latest snapshot",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-snapshoturl=<url>", "Optional: URL for the snapshot.zip file (ex: "
Expand Down Expand Up @@ -355,16 +353,48 @@ void SetupServerArgs()
GRIDCOIN_CONF_FILENAME, GRIDCOIN_SETTINGS_FILENAME),
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-startupnotify=<cmd>", "Execute command on startup.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-scraper", "Activate scraper for statistics downloads. This will only work if the node has a wallet "
"key that is authorized by the network. (Default: 0).",
argsman.AddArg("-enablesidestaking", "Enable side staking functionality (default: 0)",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-explorer", "Activate extended statistics file retention for the scraper. This will only work if the"
"node is authorized for scraping and the scraper is activated. (Default: 0)",
argsman.AddArg("-staking", "Allow wallet to stake if conditions to stake are met (default: 1)",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-sidestake=<address,percent>", "Sidestake destination and allocation entry. There can be as many "
"specified as desired. Only six per stake can be sent. If more than "
"six are specified. Six are randomly chosen for each stake. Only active "
"if -enablesidestaking is set.",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-enablestakesplit", "Enable unspent output spitting when staking to optimize staking efficiency "
"(default: 0",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-stakingefficiency=<percent>", "Specify target staking efficiency for stake splitting (default: 90, "
"clamped to [75, 98])",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-minstakesplitvalue=<n>", strprintf("Specify minimum output value for post split output when stake "
"splitting (default: %" PRId64 "GRC)", MIN_STAKE_SPLIT_VALUE_GRC),
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);

// Scraper
argsman.AddArg("-scraper", "Activate scraper for statistics downloads. This will only work if the node has a wallet "
"key that is authorized by the network (default: 0).",
ArgsManager::ALLOW_ANY, OptionsCategory::SCRAPER);
argsman.AddArg("-explorer", "Activate extended statistics file retention for the scraper. This will only work if the"
"node is authorized for scraping and the scraper is activated (default: 0)",
ArgsManager::ALLOW_ANY, OptionsCategory::SCRAPER);
argsman.AddArg("-scraperkey", "Manually specify scraper public key. This is not necessary and will not work if the"
"private key is not present in the scraper wallet file.",
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
ArgsManager::ALLOW_ANY, OptionsCategory::SCRAPER);

// Researcher (beacon, boinc, etc.)
argsman.AddArg("-email=<email>", "Email address to use for CPID detection. Must match your BOINC account email",
ArgsManager::ALLOW_ANY, OptionsCategory::RESEARCHER);
argsman.AddArg("-boincdatadir=<path>", "Path to the BOINC data directory for CPID detection when the BOINC client uses"
" a non-default directory",
ArgsManager::ALLOW_ANY, OptionsCategory::RESEARCHER);
argsman.AddArg("-forcecpid=<cpid>", "Override automatic CPID detection with the specified CPID",
ArgsManager::ALLOW_ANY, OptionsCategory::RESEARCHER);
argsman.AddArg("-investor", "Disable CPID detection and do not participate in the research reward system",
ArgsManager::ALLOW_ANY, OptionsCategory::RESEARCHER);
argsman.AddArg("-pooloperator", "Skip pool CPID checks for staking nodes run by pool administrators",
ArgsManager::ALLOW_ANY, OptionsCategory::RESEARCHER);

// Wallet
argsman.AddArg("-upgradewallet", "Upgrade wallet to latest format",
Expand All @@ -390,6 +420,22 @@ void SetupServerArgs()
argsman.AddArg("-walletbackupintervalsecs=<n>", "Optional: Create a wallet backup every <n> seconds. Zero disables"
" backups (default: 86400)",
ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
argsman.AddArg("-backupdir=<path>", "Specify backup directory for wallet backups (default: walletbackups).",
ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
argsman.AddArg("-maintainbackupretention", "Activate retention management of backup files (default: 0)",
ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
argsman.AddArg("-walletbackupretainnumfiles=<n>", "Specify maximum number of backup files to retain (default: 365). "
"Note that the actual files retained is the greater of this setting "
"and the other setting -walletbackupretainnumdays.",
ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
argsman.AddArg("-walletbackupretainnumdays=<n>", "Specify maximum number of backup files to retain (default: 365). "
"Note that the actual files retained is the greater of this setting "
"and the other setting -walletbackupretainnumfiles.",
ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
argsman.AddArg("-enableaccounts", "DEPRECATED: Enable accounting functionality (default: 0)",
ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
argsman.AddArg("-maxsigcachesize=<n>", "Set maximum size for signature cache (default: 50000)",
ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);


// Connections
Expand Down Expand Up @@ -479,6 +525,28 @@ void SetupServerArgs()
hidden_args.emplace_back("-devbuild");
hidden_args.emplace_back("-scrapersleep");
hidden_args.emplace_back("-Activebeforesb");
hidden_args.emplace_back("-clearbeaconhistory");

// -boinckey should now be removed entirely. It is put here to prevent the executable erroring out on
// an invalid parameter for old clients that may have left the argument in.
hidden_args.emplace_back("-boinckey");

hidden_args.emplace_back("-printstakemodifier");
hidden_args.emplace_back("-printpriority");
hidden_args.emplace_back("-printkeypool");

// -limitfreerelay is probably destined for the trash-heap on the next fee rewrite.
hidden_args.emplace_back("-limitfreerelay");

// Rob?
hidden_args.emplace_back("-autoban");

// These probably should be removed
hidden_args.emplace_back("-printcoinage");
hidden_args.emplace_back("-privdb");

// This is hidden because it defaults to true and should NEVER be changed unless you know what you are doing.
hidden_args.emplace_back("-flushwallet");

SetupChainParamsBaseOptions(argsman);

Expand Down
4 changes: 4 additions & 0 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ static void SetupUIArgs(ArgsManager& argsman)
ArgsManager::ALLOW_ANY, OptionsCategory::GUI);
argsman.AddArg("-splash", "Show splash screen on startup (default: 1)",
ArgsManager::ALLOW_ANY, OptionsCategory::GUI);
argsman.AddArg("-style", "Specify GUI style for Qt to use on Windows and MacOS (default: fusion)",
ArgsManager::ALLOW_ANY, OptionsCategory::GUI);
argsman.AddArg("-suppressnetworkgraph", "Suppress network graph (default: 0)",
ArgsManager::ALLOW_ANY, OptionsCategory::GUI);

}

Expand Down
21 changes: 0 additions & 21 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,26 +78,6 @@

extern int GetDayOfYear(int64_t timestamp);

/**
* Allows search of mapArgs and mapMultiArgs in a case insensitive way
*/

/*
struct mapArgscomp
{
bool operator() (const std::string& lhs, const std::string& rhs) const
{
return strcasecmp(lhs.c_str(), rhs.c_str()) < 0;
}
};
*/

//typedef std::map<std::string, std::string, mapArgscomp> ArgsMap;
//typedef std::map<std::string, std::vector<std::string>, mapArgscomp> ArgsMultiMap;

//extern ArgsMap mapArgs;
//extern ArgsMultiMap mapMultiArgs;

extern bool fPrintToConsole;
extern bool fPrintToDebugger;
extern bool fRequestShutdown;
Expand All @@ -122,7 +102,6 @@ void PrintExceptionContinue(std::exception* pex, const char* pszThread);
std::string FormatMoney(int64_t n, bool fPlus=false);
bool ParseMoney(const std::string& str, int64_t& nRet);
bool ParseMoney(const char* pszIn, int64_t& nRet);
// void ParseParameters(int argc, const char*const argv[]);
bool WildcardMatch(const char* psz, const char* mask);
bool WildcardMatch(const std::string& str, const std::string& mask);
bool TryCreateDirectories(const fs::path& p);
Expand Down
88 changes: 47 additions & 41 deletions src/util/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,47 +572,53 @@ std::string ArgsManager::GetHelpMessage() const
LOCK(cs_args);
for (const auto& arg_map : m_available_args) {
switch(arg_map.first) {
case OptionsCategory::OPTIONS:
usage += HelpMessageGroup("Options:");
break;
case OptionsCategory::CONNECTION:
usage += HelpMessageGroup("Connection options:");
break;
case OptionsCategory::ZMQ:
usage += HelpMessageGroup("ZeroMQ notification options:");
break;
case OptionsCategory::DEBUG_TEST:
usage += HelpMessageGroup("Debugging/Testing options:");
break;
case OptionsCategory::NODE_RELAY:
usage += HelpMessageGroup("Node relay options:");
break;
case OptionsCategory::BLOCK_CREATION:
usage += HelpMessageGroup("Block creation options:");
break;
case OptionsCategory::RPC:
usage += HelpMessageGroup("RPC server options:");
break;
case OptionsCategory::WALLET:
usage += HelpMessageGroup("Wallet options:");
break;
case OptionsCategory::WALLET_DEBUG_TEST:
if (show_debug) usage += HelpMessageGroup("Wallet debugging/testing options:");
break;
case OptionsCategory::CHAINPARAMS:
usage += HelpMessageGroup("Chain selection options:");
break;
case OptionsCategory::GUI:
usage += HelpMessageGroup("UI Options:");
break;
case OptionsCategory::COMMANDS:
usage += HelpMessageGroup("Commands:");
break;
case OptionsCategory::REGISTER_COMMANDS:
usage += HelpMessageGroup("Register Commands:");
break;
default:
break;
case OptionsCategory::OPTIONS:
usage += HelpMessageGroup("Options:");
break;
case OptionsCategory::CONNECTION:
usage += HelpMessageGroup("Connection options:");
break;
case OptionsCategory::ZMQ:
usage += HelpMessageGroup("ZeroMQ notification options:");
break;
case OptionsCategory::DEBUG_TEST:
usage += HelpMessageGroup("Debugging/Testing options:");
break;
case OptionsCategory::NODE_RELAY:
usage += HelpMessageGroup("Node relay options:");
break;
case OptionsCategory::BLOCK_CREATION:
usage += HelpMessageGroup("Block creation options:");
break;
case OptionsCategory::RPC:
usage += HelpMessageGroup("RPC server options:");
break;
case OptionsCategory::WALLET:
usage += HelpMessageGroup("Wallet options:");
break;
case OptionsCategory::WALLET_DEBUG_TEST:
if (show_debug) usage += HelpMessageGroup("Wallet debugging/testing options:");
break;
case OptionsCategory::CHAINPARAMS:
usage += HelpMessageGroup("Chain selection options:");
break;
case OptionsCategory::GUI:
usage += HelpMessageGroup("UI Options:");
break;
case OptionsCategory::COMMANDS:
usage += HelpMessageGroup("Commands:");
break;
case OptionsCategory::REGISTER_COMMANDS:
usage += HelpMessageGroup("Register Commands:");
break;
case OptionsCategory::SCRAPER:
usage += HelpMessageGroup("Scraper options:");
break;
case OptionsCategory::RESEARCHER:
usage += HelpMessageGroup("Researcher options:");
break;
default:
break;
}

// When we get to the hidden options, stop
Expand Down
2 changes: 2 additions & 0 deletions src/util/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ enum class OptionsCategory {
GUI,
COMMANDS,
REGISTER_COMMANDS,
SCRAPER,
RESEARCHER,

HIDDEN // Always the last option to avoid printing these in the help
};
Expand Down

0 comments on commit f1fc84f

Please sign in to comment.