Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/init.cpp
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | gArgs.AddArg("-mintxfee=<amt>", | ||||
"zero fee for transaction creation (default: %s)"), | "zero fee for transaction creation (default: %s)"), | ||||
CURRENCY_UNIT, | CURRENCY_UNIT, | ||||
FormatMoney(DEFAULT_TRANSACTION_MINFEE_PER_KB)), | FormatMoney(DEFAULT_TRANSACTION_MINFEE_PER_KB)), | ||||
false, OptionsCategory::WALLET); | false, OptionsCategory::WALLET); | ||||
gArgs.AddArg( | 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(CFeeRate{DEFAULT_PAY_TX_FEE}.GetFeePerK())), | |||||
false, OptionsCategory::WALLET); | false, OptionsCategory::WALLET); | ||||
gArgs.AddArg( | gArgs.AddArg( | ||||
"-rescan", | "-rescan", | ||||
_("Rescan the block chain for missing wallet transactions on startup"), | _("Rescan the block chain for missing wallet transactions on startup"), | ||||
false, OptionsCategory::WALLET); | false, OptionsCategory::WALLET); | ||||
gArgs.AddArg( | 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"), | ||||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | bool WalletInit::ParameterInteraction() const { | ||||
} | } | ||||
if (minRelayTxFee.GetFeePerK() > HIGH_TX_FEE_PER_KB) { | if (minRelayTxFee.GetFeePerK() > HIGH_TX_FEE_PER_KB) { | ||||
InitWarning( | InitWarning( | ||||
AmountHighWarn("-minrelaytxfee") + " " + | AmountHighWarn("-minrelaytxfee") + " " + | ||||
_("The wallet will avoid paying less than the minimum relay fee.")); | _("The wallet will avoid paying less than the minimum relay fee.")); | ||||
} | } | ||||
if (gArgs.IsArgSet("-fallbackfee")) { | |||||
Amount nFeePerK = Amount::zero(); | |||||
if (!ParseMoney(gArgs.GetArg("-fallbackfee", ""), nFeePerK)) { | |||||
return InitError( | |||||
strprintf(_("Invalid amount for -fallbackfee=<amount>: '%s'"), | |||||
gArgs.GetArg("-fallbackfee", ""))); | |||||
} | |||||
if (nFeePerK > HIGH_TX_FEE_PER_KB) { | |||||
InitWarning(AmountHighWarn("-fallbackfee") + " " + | |||||
_("This is the transaction fee you may pay when fee " | |||||
"estimates are not available.")); | |||||
} | |||||
CWallet::fallbackFee = CFeeRate(nFeePerK); | |||||
} | |||||
if (gArgs.IsArgSet("-paytxfee")) { | |||||
Amount nFeePerK = Amount::zero(); | |||||
if (!ParseMoney(gArgs.GetArg("-paytxfee", ""), nFeePerK)) { | |||||
return InitError( | |||||
AmountErrMsg("paytxfee", gArgs.GetArg("-paytxfee", ""))); | |||||
} | |||||
if (nFeePerK > HIGH_TX_FEE_PER_KB) { | |||||
InitWarning(AmountHighWarn("-paytxfee") + " " + | |||||
_("This is the transaction fee you will pay if you " | |||||
"send a transaction.")); | |||||
} | |||||
payTxFee = CFeeRate(nFeePerK, 1000); | |||||
if (payTxFee < minRelayTxFee) { | |||||
return InitError(strprintf( | |||||
_("Invalid amount for -paytxfee=<amount>: '%s' (must " | |||||
"be at least %s)"), | |||||
gArgs.GetArg("-paytxfee", ""), minRelayTxFee.ToString())); | |||||
} | |||||
} | |||||
if (gArgs.IsArgSet("-maxtxfee")) { | if (gArgs.IsArgSet("-maxtxfee")) { | ||||
Amount nMaxFee = Amount::zero(); | Amount nMaxFee = Amount::zero(); | ||||
if (!ParseMoney(gArgs.GetArg("-maxtxfee", ""), nMaxFee)) { | if (!ParseMoney(gArgs.GetArg("-maxtxfee", ""), nMaxFee)) { | ||||
return InitError( | return InitError( | ||||
AmountErrMsg("maxtxfee", gArgs.GetArg("-maxtxfee", ""))); | AmountErrMsg("maxtxfee", gArgs.GetArg("-maxtxfee", ""))); | ||||
} | } | ||||
if (nMaxFee > HIGH_MAX_TX_FEE) { | if (nMaxFee > HIGH_MAX_TX_FEE) { | ||||
InitWarning(_("-maxtxfee is set very high! Fees this large could " | InitWarning(_("-maxtxfee is set very high! Fees this large could " | ||||
"be paid on a single transaction.")); | "be paid on a single transaction.")); | ||||
} | } | ||||
maxTxFee = nMaxFee; | maxTxFee = nMaxFee; | ||||
if (CFeeRate(maxTxFee, 1000) < minRelayTxFee) { | if (CFeeRate(maxTxFee, 1000) < minRelayTxFee) { | ||||
return InitError(strprintf( | return InitError(strprintf( | ||||
_("Invalid amount for -maxtxfee=<amount>: '%s' (must " | _("Invalid amount for -maxtxfee=<amount>: '%s' (must " | ||||
"be at least the minrelay fee of %s to prevent " | "be at least the minrelay fee of %s to prevent " | ||||
"stuck transactions)"), | "stuck transactions)"), | ||||
gArgs.GetArg("-maxtxfee", ""), minRelayTxFee.ToString())); | gArgs.GetArg("-maxtxfee", ""), minRelayTxFee.ToString())); | ||||
} | } | ||||
} | } | ||||
if (gArgs.IsArgSet("-mintxfee")) { | |||||
Amount n = Amount::zero(); | |||||
auto parsed = ParseMoney(gArgs.GetArg("-mintxfee", ""), n); | |||||
if (!parsed || n == Amount::zero()) { | |||||
return InitError( | |||||
AmountErrMsg("mintxfee", gArgs.GetArg("-mintxfee", ""))); | |||||
} | |||||
if (n > HIGH_TX_FEE_PER_KB) { | |||||
InitWarning(AmountHighWarn("-mintxfee") + " " + | |||||
_("This is the minimum transaction fee you pay on " | |||||
"every transaction.")); | |||||
} | |||||
CWallet::minTxFee = CFeeRate(n); | |||||
} | |||||
bSpendZeroConfChange = | |||||
gArgs.GetBoolArg("-spendzeroconfchange", DEFAULT_SPEND_ZEROCONF_CHANGE); | |||||
g_address_type = OutputType::DEFAULT; | g_address_type = OutputType::DEFAULT; | ||||
g_change_type = OutputType::DEFAULT; | g_change_type = OutputType::DEFAULT; | ||||
return true; | return true; | ||||
} | } | ||||
void WalletInit::RegisterRPC(CRPCTable &t) const { | void WalletInit::RegisterRPC(CRPCTable &t) const { | ||||
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) { | if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) { | ||||
▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines |