Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/init.cpp
Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | argsman.AddArg( | ||||
"Execute command when a wallet transaction changes. %s in cmd " | "Execute command when a wallet transaction changes. %s in cmd " | ||||
"is replaced by TxID and %w is replaced by wallet name. %w is " | "is replaced by TxID and %w is replaced by wallet name. %w is " | ||||
"not currently implemented on windows. On systems where %w is " | "not currently implemented on windows. On systems where %w is " | ||||
"supported, it should NOT be quoted because this would break " | "supported, it should NOT be quoted because this would break " | ||||
"shell escaping used to invoke the command.", | "shell escaping used to invoke the command.", | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::WALLET); | ArgsManager::ALLOW_ANY, OptionsCategory::WALLET); | ||||
#endif | #endif | ||||
argsman.AddArg( | argsman.AddArg( | ||||
"-zapwallettxes=<mode>", | |||||
"Delete all wallet transactions and only recover those parts of the " | |||||
"blockchain through -rescan on startup (1 = keep tx meta data e.g. " | |||||
"payment request information, 2 = drop tx meta data)", | |||||
ArgsManager::ALLOW_ANY, OptionsCategory::WALLET); | |||||
argsman.AddArg( | |||||
"-dblogsize=<n>", | "-dblogsize=<n>", | ||||
strprintf("Flush wallet database activity from memory to disk " | strprintf("Flush wallet database activity from memory to disk " | ||||
"log every <n> megabytes (default: %u)", | "log every <n> megabytes (default: %u)", | ||||
DEFAULT_WALLET_DBLOGSIZE), | DEFAULT_WALLET_DBLOGSIZE), | ||||
ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ||||
OptionsCategory::WALLET_DEBUG_TEST); | OptionsCategory::WALLET_DEBUG_TEST); | ||||
argsman.AddArg( | argsman.AddArg( | ||||
"-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), | ||||
ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ||||
OptionsCategory::WALLET_DEBUG_TEST); | OptionsCategory::WALLET_DEBUG_TEST); | ||||
argsman.AddArg("-privdb", | argsman.AddArg("-privdb", | ||||
strprintf("Sets the DB_PRIVATE flag in the wallet db " | strprintf("Sets the DB_PRIVATE flag in the wallet db " | ||||
"environment (default: %d)", | "environment (default: %d)", | ||||
DEFAULT_WALLET_PRIVDB), | DEFAULT_WALLET_PRIVDB), | ||||
ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ||||
OptionsCategory::WALLET_DEBUG_TEST); | OptionsCategory::WALLET_DEBUG_TEST); | ||||
argsman.AddArg("-walletrejectlongchains", | argsman.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), | ||||
ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ||||
OptionsCategory::WALLET_DEBUG_TEST); | OptionsCategory::WALLET_DEBUG_TEST); | ||||
argsman.AddHiddenArgs({"-zapwallettxes"}); | |||||
} | } | ||||
bool WalletInit::ParameterInteraction() const { | bool WalletInit::ParameterInteraction() const { | ||||
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) { | if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) { | ||||
for (const std::string &wallet : gArgs.GetArgs("-wallet")) { | for (const std::string &wallet : gArgs.GetArgs("-wallet")) { | ||||
LogPrintf("%s: parameter interaction: -disablewallet -> ignoring " | LogPrintf("%s: parameter interaction: -disablewallet -> ignoring " | ||||
"-wallet=%s\n", | "-wallet=%s\n", | ||||
__func__, wallet); | __func__, wallet); | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
const bool is_multiwallet = gArgs.GetArgs("-wallet").size() > 1; | |||||
if (gArgs.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && | if (gArgs.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && | ||||
gArgs.SoftSetBoolArg("-walletbroadcast", false)) { | gArgs.SoftSetBoolArg("-walletbroadcast", false)) { | ||||
LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting " | LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting " | ||||
"-walletbroadcast=0\n", | "-walletbroadcast=0\n", | ||||
__func__); | __func__); | ||||
} | } | ||||
bool zapwallettxes = gArgs.GetBoolArg("-zapwallettxes", false); | if (gArgs.IsArgSet("-zapwallettxes")) { | ||||
// -zapwallettxes implies dropping the mempool on startup | return InitError( | ||||
if (zapwallettxes && gArgs.SoftSetBoolArg("-persistmempool", false)) { | Untranslated("-zapwallettxes has been removed. If you are " | ||||
LogPrintf("%s: parameter interaction: -zapwallettxes enabled -> " | "attempting to remove a stuck transaction from your " | ||||
"setting -persistmempool=0\n", | "wallet, please use abandontransaction instead.")); | ||||
__func__); | |||||
} | |||||
// -zapwallettxes implies a rescan | |||||
if (zapwallettxes) { | |||||
if (is_multiwallet) { | |||||
return InitError(strprintf( | |||||
Untranslated("%s is only allowed with a single wallet file"), | |||||
"-zapwallettxes")); | |||||
} | |||||
if (gArgs.SoftSetBoolArg("-rescan", true)) { | |||||
LogPrintf("%s: parameter interaction: -zapwallettxes enabled -> " | |||||
"setting -rescan=1\n", | |||||
__func__); | |||||
} | |||||
} | } | ||||
if (gArgs.GetBoolArg("-sysperms", false)) { | if (gArgs.GetBoolArg("-sysperms", false)) { | ||||
return InitError( | return InitError( | ||||
Untranslated("-sysperms is not allowed in combination with enabled " | Untranslated("-sysperms is not allowed in combination with enabled " | ||||
"wallet functionality")); | "wallet functionality")); | ||||
} | } | ||||
Show All 15 Lines |