Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/init.cpp
Show All 13 Lines | |||||
#include <wallet/rpcwallet.h> | #include <wallet/rpcwallet.h> | ||||
#include <wallet/wallet.h> | #include <wallet/wallet.h> | ||||
#include <wallet/walletutil.h> | #include <wallet/walletutil.h> | ||||
#include <walletinitinterface.h> | #include <walletinitinterface.h> | ||||
class WalletInit : public WalletInitInterface { | class WalletInit : public WalletInitInterface { | ||||
public: | public: | ||||
//! Return the wallets help message. | //! Return the wallets help message. | ||||
std::string GetHelpString(bool showDebug) const override; | void AddWalletOptions() const override; | ||||
//! Wallets parameter interaction | //! Wallets parameter interaction | ||||
bool ParameterInteraction() const override; | bool ParameterInteraction() const override; | ||||
//! Register wallet RPCs. | //! Register wallet RPCs. | ||||
void RegisterRPC(CRPCTable &tableRPC) const override; | void RegisterRPC(CRPCTable &tableRPC) const override; | ||||
//! Responsible for reading and validating the -wallet arguments and | //! Responsible for reading and validating the -wallet arguments and | ||||
Show All 16 Lines | public: | ||||
void Stop() const override; | void Stop() const override; | ||||
//! Close all wallets. | //! Close all wallets. | ||||
void Close() const override; | void Close() const override; | ||||
}; | }; | ||||
const WalletInitInterface &g_wallet_init_interface = WalletInit(); | const WalletInitInterface &g_wallet_init_interface = WalletInit(); | ||||
std::string WalletInit::GetHelpString(bool showDebug) const { | void WalletInit::AddWalletOptions() const { | ||||
std::string strUsage = HelpMessageGroup(_("Wallet options:")); | gArgs.AddArg("-disablewallet", | ||||
strUsage += HelpMessageOpt( | _("Do not load the wallet and disable wallet RPC calls"), | ||||
"-disablewallet", | false, OptionsCategory::WALLET); | ||||
_("Do not load the wallet and disable wallet RPC calls")); | gArgs.AddArg("-keypool=<n>", | ||||
strUsage += HelpMessageOpt( | strprintf(_("Set key pool size to <n> (default: %u)"), | ||||
"-keypool=<n>", strprintf(_("Set key pool size to <n> (default: %u)"), | DEFAULT_KEYPOOL_SIZE), | ||||
DEFAULT_KEYPOOL_SIZE)); | false, OptionsCategory::WALLET); | ||||
strUsage += HelpMessageOpt( | gArgs.AddArg("-fallbackfee=<amt>", | ||||
"-fallbackfee=<amt>", | |||||
strprintf(_("A fee rate (in %s/kB) that will be used when fee " | strprintf(_("A fee rate (in %s/kB) that will be used when fee " | ||||
"estimation has insufficient data (default: %s)"), | "estimation has insufficient data (default: %s)"), | ||||
CURRENCY_UNIT, FormatMoney(DEFAULT_FALLBACK_FEE))); | CURRENCY_UNIT, FormatMoney(DEFAULT_FALLBACK_FEE)), | ||||
strUsage += HelpMessageOpt( | false, OptionsCategory::WALLET); | ||||
gArgs.AddArg( | |||||
"-paytxfee=<amt>", | "-paytxfee=<amt>", | ||||
strprintf( | strprintf( | ||||
_("Fee (in %s/kB) to add to transactions you send (default: %s)"), | _("Fee (in %s/kB) to add to transactions you send (default: %s)"), | ||||
CURRENCY_UNIT, FormatMoney(payTxFee.GetFeePerK()))); | CURRENCY_UNIT, FormatMoney(payTxFee.GetFeePerK())), | ||||
strUsage += HelpMessageOpt( | false, OptionsCategory::WALLET); | ||||
gArgs.AddArg( | |||||
"-rescan", | "-rescan", | ||||
_("Rescan the block chain for missing wallet transactions on startup")); | _("Rescan the block chain for missing wallet transactions on startup"), | ||||
strUsage += HelpMessageOpt( | false, OptionsCategory::WALLET); | ||||
gArgs.AddArg( | |||||
"-salvagewallet", | "-salvagewallet", | ||||
_("Attempt to recover private keys from a corrupt wallet on startup")); | _("Attempt to recover private keys from a corrupt wallet on startup"), | ||||
false, OptionsCategory::WALLET); | |||||
strUsage += | gArgs.AddArg("-spendzeroconfchange", | ||||
HelpMessageOpt("-spendzeroconfchange", | |||||
strprintf(_("Spend unconfirmed change when sending " | strprintf(_("Spend unconfirmed change when sending " | ||||
"transactions (default: %d)"), | "transactions (default: %d)"), | ||||
DEFAULT_SPEND_ZEROCONF_CHANGE)); | DEFAULT_SPEND_ZEROCONF_CHANGE), | ||||
strUsage += HelpMessageOpt( | false, OptionsCategory::WALLET); | ||||
gArgs.AddArg( | |||||
"-usehd", | "-usehd", | ||||
_("Use hierarchical deterministic key generation (HD) after BIP32. " | _("Use hierarchical deterministic key generation (HD) after BIP32. " | ||||
"Only has effect during wallet creation/first start") + | "Only has effect during wallet creation/first start") + | ||||
" " + strprintf(_("(default: %d)"), DEFAULT_USE_HD_WALLET)); | " " + strprintf(_("(default: %d)"), DEFAULT_USE_HD_WALLET), | ||||
strUsage += HelpMessageOpt("-upgradewallet", | false, OptionsCategory::WALLET); | ||||
_("Upgrade wallet to latest format on startup")); | gArgs.AddArg("-upgradewallet", | ||||
strUsage += | _("Upgrade wallet to latest format on startup"), false, | ||||
HelpMessageOpt("-wallet=<file>", | OptionsCategory::WALLET); | ||||
gArgs.AddArg("-wallet=<file>", | |||||
_("Specify wallet file (within data directory)") + " " + | _("Specify wallet file (within data directory)") + " " + | ||||
strprintf(_("(default: %s)"), DEFAULT_WALLET_DAT)); | strprintf(_("(default: %s)"), DEFAULT_WALLET_DAT), | ||||
strUsage += HelpMessageOpt( | false, OptionsCategory::WALLET); | ||||
"-walletbroadcast", | gArgs.AddArg("-walletbroadcast", | ||||
_("Make the wallet broadcast transactions") + " " + | _("Make the wallet broadcast transactions") + " " + | ||||
strprintf(_("(default: %d)"), DEFAULT_WALLETBROADCAST)); | strprintf(_("(default: %d)"), DEFAULT_WALLETBROADCAST), | ||||
strUsage += HelpMessageOpt( | false, OptionsCategory::WALLET); | ||||
"-walletdir=<dir>", | gArgs.AddArg("-walletdir=<dir>", | ||||
_("Specify directory to hold wallets (default: <datadir>/wallets if it " | _("Specify directory to hold wallets (default: " | ||||
"exists, otherwise <datadir>)")); | "<datadir>/wallets if it exists, otherwise <datadir>)"), | ||||
strUsage += HelpMessageOpt("-walletnotify=<cmd>", | false, OptionsCategory::WALLET); | ||||
_("Execute command when a wallet transaction " | gArgs.AddArg("-walletnotify=<cmd>", | ||||
"changes (%s in cmd is replaced by TxID)")); | _("Execute command when a wallet transaction changes (%s in " | ||||
strUsage += HelpMessageOpt( | "cmd is replaced by TxID)"), | ||||
"-zapwallettxes=<mode>", | false, OptionsCategory::WALLET); | ||||
_("Delete all wallet transactions and only recover those parts of the " | gArgs.AddArg("-zapwallettxes=<mode>", | ||||
"blockchain through -rescan on startup") + | _("Delete all wallet transactions and only recover those " | ||||
"parts of the blockchain through -rescan on startup") + | |||||
" " + | " " + | ||||
_("(1 = keep tx meta data e.g. account owner and payment " | _("(1 = keep tx meta data e.g. account owner and payment " | ||||
"request information, 2 = drop tx meta data)")); | "request information, 2 = drop tx meta data)"), | ||||
false, OptionsCategory::WALLET); | |||||
if (showDebug) { | gArgs.AddArg("-dblogsize=<n>", | ||||
strUsage += HelpMessageGroup(_("Wallet debugging/testing options:")); | strprintf("Flush wallet database activity from memory to disk " | ||||
"log every <n> megabytes (default: %u)", | |||||
strUsage += HelpMessageOpt( | DEFAULT_WALLET_DBLOGSIZE), | ||||
"-dblogsize=<n>", | true, OptionsCategory::WALLET_DEBUG_TEST); | ||||
strprintf("Flush wallet database activity from memory to disk log " | gArgs.AddArg( | ||||
"every <n> megabytes (default: %u)", | |||||
DEFAULT_WALLET_DBLOGSIZE)); | |||||
strUsage += HelpMessageOpt( | |||||
"-flushwallet", | "-flushwallet", | ||||
strprintf("Run a thread to flush wallet periodically (default: %d)", | strprintf("Run a thread to flush wallet periodically (default: %d)", | ||||
DEFAULT_FLUSHWALLET)); | DEFAULT_FLUSHWALLET), | ||||
strUsage += HelpMessageOpt( | true, OptionsCategory::WALLET_DEBUG_TEST); | ||||
"-privdb", strprintf("Sets the DB_PRIVATE flag in the wallet db " | gArgs.AddArg("-privdb", | ||||
strprintf("Sets the DB_PRIVATE flag in the wallet db " | |||||
"environment (default: %d)", | "environment (default: %d)", | ||||
DEFAULT_WALLET_PRIVDB)); | DEFAULT_WALLET_PRIVDB), | ||||
strUsage += HelpMessageOpt( | true, OptionsCategory::WALLET_DEBUG_TEST); | ||||
"-walletrejectlongchains", | gArgs.AddArg("-walletrejectlongchains", | ||||
strprintf(_("Wallet will not create transactions that violate " | strprintf(_("Wallet will not create transactions that violate " | ||||
"mempool chain limits (default: %d)"), | "mempool chain limits (default: %d)"), | ||||
DEFAULT_WALLET_REJECT_LONG_CHAINS)); | DEFAULT_WALLET_REJECT_LONG_CHAINS), | ||||
} | true, OptionsCategory::WALLET_DEBUG_TEST); | ||||
return strUsage; | |||||
} | } | ||||
bool WalletInit::ParameterInteraction() const { | bool WalletInit::ParameterInteraction() const { | ||||
CFeeRate minRelayTxFee = GetConfig().GetMinFeePerKB(); | CFeeRate minRelayTxFee = GetConfig().GetMinFeePerKB(); | ||||
gArgs.SoftSetArg("-wallet", DEFAULT_WALLET_DAT); | gArgs.SoftSetArg("-wallet", DEFAULT_WALLET_DAT); | ||||
const bool is_multiwallet = gArgs.GetArgs("-wallet").size() > 1; | const bool is_multiwallet = gArgs.GetArgs("-wallet").size() > 1; | ||||
▲ Show 20 Lines • Show All 282 Lines • Show Last 20 Lines |