Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | |||||
std::unique_ptr<CConnman> g_connman; | std::unique_ptr<CConnman> g_connman; | ||||
std::unique_ptr<PeerLogicValidation> peerLogic; | std::unique_ptr<PeerLogicValidation> peerLogic; | ||||
std::unique_ptr<BanMan> g_banman; | std::unique_ptr<BanMan> g_banman; | ||||
#if !(ENABLE_WALLET) | #if !(ENABLE_WALLET) | ||||
class DummyWalletInit : public WalletInitInterface { | class DummyWalletInit : public WalletInitInterface { | ||||
public: | public: | ||||
void AddWalletOptions() const override {} | void AddWalletOptions() const override; | ||||
bool ParameterInteraction() const override { return true; } | bool ParameterInteraction() const override { return true; } | ||||
void RegisterRPC(CRPCTable &) const override {} | void RegisterRPC(CRPCTable &) const override {} | ||||
bool Verify(const CChainParams &chainParams) const override { return true; } | bool Verify(const CChainParams &chainParams) const override { return true; } | ||||
bool Open(const CChainParams &chainParams) const override { | bool Open(const CChainParams &chainParams) const override { | ||||
LogPrintf("No wallet support compiled in!\n"); | LogPrintf("No wallet support compiled in!\n"); | ||||
return true; | return true; | ||||
} | } | ||||
void Start(CScheduler &scheduler) const override {} | void Start(CScheduler &scheduler) const override {} | ||||
void Flush() const override {} | void Flush() const override {} | ||||
void Stop() const override {} | void Stop() const override {} | ||||
void Close() const override {} | void Close() const override {} | ||||
}; | }; | ||||
void DummyWalletInit::AddWalletOptions() const { | |||||
std::vector<std::string> opts = { | |||||
"-avoidpartialspends", "-disablewallet", "-fallbackfee=<amt>", | |||||
"-keypool=<n>", "-maxtxfee=<amt>", "-mintxfee=<amt>", "-paytxfee=<amt>", | |||||
"-rescan", "-salvagewallet", "-spendzeroconfchange", "-upgradewallet", | |||||
"-wallet=<path>", "-walletbroadcast", "-walletdir=<dir>", | |||||
"-walletnotify=<cmd>", "-zapwallettxes=<mode>", | |||||
// Wallet debug options | |||||
"-dblogsize=<n>", "-flushwallet", "-privdb", "-walletrejectlongchains"}; | |||||
gArgs.AddHiddenArgs(opts); | |||||
} | |||||
const WalletInitInterface &g_wallet_init_interface = DummyWalletInit(); | const WalletInitInterface &g_wallet_init_interface = DummyWalletInit(); | ||||
#endif | #endif | ||||
#ifdef WIN32 | #ifdef WIN32 | ||||
// Win32 LevelDB doesn't use filedescriptors, and the ones used for accessing | // Win32 LevelDB doesn't use filedescriptors, and the ones used for accessing | ||||
// block files don't count towards the fd_set size limit anyway. | // block files don't count towards the fd_set size limit anyway. | ||||
#define MIN_CORE_FILEDESCRIPTORS 0 | #define MIN_CORE_FILEDESCRIPTORS 0 | ||||
#else | #else | ||||
▲ Show 20 Lines • Show All 223 Lines • ▼ Show 20 Lines | void SetupServerArgs() { | ||||
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 defaultChainParams = CreateChainParams(CBaseChainParams::MAIN); | const auto defaultChainParams = CreateChainParams(CBaseChainParams::MAIN); | ||||
const auto testnetChainParams = | const auto testnetChainParams = | ||||
CreateChainParams(CBaseChainParams::TESTNET); | CreateChainParams(CBaseChainParams::TESTNET); | ||||
// Hidden Options | |||||
std::vector<std::string> hidden_args = { | |||||
"-rpcssl", "-benchmark", "-h", "-help", "-socks", "-tor", "-debugnet", | |||||
"-whitelistalwaysrelay", "-blockminsize", "-dbcrashratio", | |||||
"-forcecompactdb", "-usehd", "-parkdeepreorg", | |||||
"-replayprotectionactivationtime", | |||||
// GUI args. These will be overwritten by SetupUIArgs for the GUI | |||||
"-allowselfsignedrootcertificates", "-choosedatadir", "-lang=<lang>", | |||||
"-min", "-resetguisettings", "-rootcertificates=<file>", "-splash", | |||||
"-uiplatform", | |||||
// TODO remove after the May 2020 upgrade | |||||
"-phononactivationtime"}; | |||||
// Set all of the args and their help | // Set all of the args and their help | ||||
// When adding new options to the categories, please keep and ensure | // When adding new options to the categories, please keep and ensure | ||||
// alphabetical ordering. Do not translate _(...) -help-debug options, Many | // alphabetical ordering. Do not translate _(...) -help-debug options, Many | ||||
// technical terms, and only a very small audience, so is unnecessary stress | // technical terms, and only a very small audience, so is unnecessary stress | ||||
// to translators. | // to translators. | ||||
gArgs.AddArg("-?", "Print this help message and exit", false, | gArgs.AddArg("-?", "Print this help message and exit", false, | ||||
OptionsCategory::OPTIONS); | OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-version", "Print version and exit", false, | gArgs.AddArg("-version", "Print version and exit", false, | ||||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | gArgs.AddArg("-persistmempool", | ||||
DEFAULT_PERSIST_MEMPOOL), | DEFAULT_PERSIST_MEMPOOL), | ||||
false, OptionsCategory::OPTIONS); | false, OptionsCategory::OPTIONS); | ||||
#ifndef WIN32 | #ifndef WIN32 | ||||
gArgs.AddArg("-pid=<file>", | gArgs.AddArg("-pid=<file>", | ||||
strprintf("Specify pid file. Relative paths will be prefixed " | strprintf("Specify pid file. Relative paths will be prefixed " | ||||
"by a net-specific datadir location. (default: %s)", | "by a net-specific datadir location. (default: %s)", | ||||
BITCOIN_PID_FILENAME), | BITCOIN_PID_FILENAME), | ||||
false, OptionsCategory::OPTIONS); | false, OptionsCategory::OPTIONS); | ||||
#else | |||||
hidden_args.emplace_back("-pid"); | |||||
#endif | #endif | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-prune=<n>", | "-prune=<n>", | ||||
strprintf("Reduce storage requirements by enabling pruning (deleting) " | strprintf("Reduce storage requirements by enabling pruning (deleting) " | ||||
"of old blocks. This allows the pruneblockchain RPC to be " | "of old blocks. This allows the pruneblockchain RPC to be " | ||||
"called to delete specific blocks, and enables automatic " | "called to delete specific blocks, and enables automatic " | ||||
"pruning of old blocks if a target size in MiB is provided. " | "pruning of old blocks if a target size in MiB is provided. " | ||||
"This mode is incompatible with -txindex and -rescan. " | "This mode is incompatible with -txindex and -rescan. " | ||||
Show All 13 Lines | gArgs.AddArg( | ||||
"Rebuild chain state and block index from the blk*.dat files on disk", | "Rebuild chain state and block index from the blk*.dat files on disk", | ||||
false, OptionsCategory::OPTIONS); | false, OptionsCategory::OPTIONS); | ||||
#ifndef WIN32 | #ifndef WIN32 | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-sysperms", | "-sysperms", | ||||
"Create new files with system default permissions, instead of umask " | "Create new files with system default permissions, instead of umask " | ||||
"077 (only effective with disabled wallet functionality)", | "077 (only effective with disabled wallet functionality)", | ||||
false, OptionsCategory::OPTIONS); | false, OptionsCategory::OPTIONS); | ||||
#else | |||||
hidden_args.emplace_back("-sysperms"); | |||||
#endif | #endif | ||||
gArgs.AddArg("-txindex", | gArgs.AddArg("-txindex", | ||||
strprintf("Maintain a full transaction index, used by the " | strprintf("Maintain a full transaction index, used by the " | ||||
"getrawtransaction rpc call (default: %d)", | "getrawtransaction rpc call (default: %d)", | ||||
DEFAULT_TXINDEX), | DEFAULT_TXINDEX), | ||||
false, OptionsCategory::OPTIONS); | false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-usecashaddr", | gArgs.AddArg("-usecashaddr", | ||||
"Use Cash Address for destination encoding instead of base58 " | "Use Cash Address for destination encoding instead of base58 " | ||||
▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | gArgs.AddArg("-upnp", | ||||
"listening and no -proxy)", | "listening and no -proxy)", | ||||
false, OptionsCategory::CONNECTION); | false, OptionsCategory::CONNECTION); | ||||
#else | #else | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-upnp", | "-upnp", | ||||
strprintf("Use UPnP to map the listening port (default: %u)", 0), false, | strprintf("Use UPnP to map the listening port (default: %u)", 0), false, | ||||
OptionsCategory::CONNECTION); | OptionsCategory::CONNECTION); | ||||
#endif | #endif | ||||
#else | |||||
hidden_args.emplace_back("-upnp"); | |||||
#endif | #endif | ||||
gArgs.AddArg("-whitebind=<addr>", | gArgs.AddArg("-whitebind=<addr>", | ||||
"Bind to given address and whitelist peers connecting to it. " | "Bind to given address and whitelist peers connecting to it. " | ||||
"Use [host]:port notation for IPv6", | "Use [host]:port notation for IPv6", | ||||
false, OptionsCategory::CONNECTION); | false, OptionsCategory::CONNECTION); | ||||
gArgs.AddArg("-whitelist=<IP address or network>", | gArgs.AddArg("-whitelist=<IP address or network>", | ||||
"Whitelist peers connecting from the given IP address (e.g. " | "Whitelist peers connecting from the given IP address (e.g. " | ||||
"1.2.3.4) or CIDR notated network (e.g. 1.2.3.0/24). Can be " | "1.2.3.4) or CIDR notated network (e.g. 1.2.3.0/24). Can be " | ||||
Show All 19 Lines | gArgs.AddArg("-zmqpubhashtx=<address>", | ||||
"Enable publish hash transaction in <address>", false, | "Enable publish hash transaction in <address>", false, | ||||
OptionsCategory::ZMQ); | OptionsCategory::ZMQ); | ||||
gArgs.AddArg("-zmqpubrawblock=<address>", | gArgs.AddArg("-zmqpubrawblock=<address>", | ||||
"Enable publish raw block in <address>", false, | "Enable publish raw block in <address>", false, | ||||
OptionsCategory::ZMQ); | OptionsCategory::ZMQ); | ||||
gArgs.AddArg("-zmqpubrawtx=<address>", | gArgs.AddArg("-zmqpubrawtx=<address>", | ||||
"Enable publish raw transaction in <address>", false, | "Enable publish raw transaction in <address>", false, | ||||
OptionsCategory::ZMQ); | OptionsCategory::ZMQ); | ||||
#else | |||||
hidden_args.emplace_back("-zmqpubhashblock=<address>"); | |||||
hidden_args.emplace_back("-zmqpubhashtx=<address>"); | |||||
hidden_args.emplace_back("-zmqpubrawblock=<address>"); | |||||
hidden_args.emplace_back("-zmqpubrawtx=<address>"); | |||||
#endif | #endif | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-checkblocks=<n>", | "-checkblocks=<n>", | ||||
strprintf("How many blocks to check at startup (default: %u, 0 = all)", | strprintf("How many blocks to check at startup (default: %u, 0 = all)", | ||||
DEFAULT_CHECKBLOCKS), | DEFAULT_CHECKBLOCKS), | ||||
true, OptionsCategory::DEBUG_TEST); | true, OptionsCategory::DEBUG_TEST); | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
▲ Show 20 Lines • Show All 274 Lines • ▼ Show 20 Lines | gArgs.AddArg("-rpcworkqueue=<n>", | ||||
"calls (default: %d)", | "calls (default: %d)", | ||||
DEFAULT_HTTP_WORKQUEUE), | DEFAULT_HTTP_WORKQUEUE), | ||||
true, OptionsCategory::RPC); | true, OptionsCategory::RPC); | ||||
gArgs.AddArg("-rpcservertimeout=<n>", | gArgs.AddArg("-rpcservertimeout=<n>", | ||||
strprintf("Timeout during HTTP requests (default: %d)", | strprintf("Timeout during HTTP requests (default: %d)", | ||||
DEFAULT_HTTP_SERVER_TIMEOUT), | DEFAULT_HTTP_SERVER_TIMEOUT), | ||||
true, OptionsCategory::RPC); | true, OptionsCategory::RPC); | ||||
// Hidden options | #if HAVE_DECL_DAEMON | ||||
gArgs.AddArg("-rpcssl", "", false, OptionsCategory::HIDDEN); | gArgs.AddArg("-daemon", | ||||
gArgs.AddArg("-benchmark", "", false, OptionsCategory::HIDDEN); | _("Run in the background as a daemon and accept commands"), | ||||
gArgs.AddArg("-h", "", false, OptionsCategory::HIDDEN); | false, OptionsCategory::OPTIONS); | ||||
gArgs.AddArg("-help", "", false, OptionsCategory::HIDDEN); | #else | ||||
gArgs.AddArg("-socks", "", false, OptionsCategory::HIDDEN); | hidden_args.emplace_back("-daemon"); | ||||
gArgs.AddArg("-tor", "", false, OptionsCategory::HIDDEN); | #endif | ||||
gArgs.AddArg("-debugnet", "", false, OptionsCategory::HIDDEN); | |||||
gArgs.AddArg("-whitelistalwaysrelay", "", false, OptionsCategory::HIDDEN); | |||||
gArgs.AddArg("-blockminsize", "", false, OptionsCategory::HIDDEN); | |||||
gArgs.AddArg("-dbcrashratio", "", false, OptionsCategory::HIDDEN); | |||||
gArgs.AddArg("-forcecompactdb", "", false, OptionsCategory::HIDDEN); | |||||
gArgs.AddArg("-usehd", "", false, OptionsCategory::HIDDEN); | |||||
gArgs.AddArg("-parkdeepreorg", "", false, OptionsCategory::HIDDEN); | |||||
gArgs.AddArg("-replayprotectionactivationtime", "", false, | |||||
OptionsCategory::HIDDEN); | |||||
// TODO remove after the May 2020 upgrade | // Add the hidden options | ||||
gArgs.AddArg("-phononactivationtime", "", false, OptionsCategory::HIDDEN); | gArgs.AddHiddenArgs(hidden_args); | ||||
} | } | ||||
std::string LicenseInfo() { | std::string LicenseInfo() { | ||||
const std::string URL_SOURCE_CODE = | const std::string URL_SOURCE_CODE = | ||||
"<https://github.com/Bitcoin-ABC/bitcoin-abc>"; | "<https://github.com/Bitcoin-ABC/bitcoin-abc>"; | ||||
const std::string URL_WEBSITE = "<https://www.bitcoinabc.org>"; | const std::string URL_WEBSITE = "<https://www.bitcoinabc.org>"; | ||||
return CopyrightHolders( | return CopyrightHolders( | ||||
▲ Show 20 Lines • Show All 1,483 Lines • Show Last 20 Lines |