Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 4,878 Lines • ▼ Show 20 Lines | if (fFirstRun) { | ||||
} | } | ||||
} | } | ||||
if (gArgs.IsArgSet("-mintxfee")) { | if (gArgs.IsArgSet("-mintxfee")) { | ||||
Amount n = Amount::zero(); | Amount n = Amount::zero(); | ||||
if (!ParseMoney(gArgs.GetArg("-mintxfee", ""), n) || | if (!ParseMoney(gArgs.GetArg("-mintxfee", ""), n) || | ||||
n == Amount::zero()) { | n == Amount::zero()) { | ||||
chain.initError( | chain.initError( | ||||
AmountErrMsg("mintxfee", gArgs.GetArg("-mintxfee", ""))); | AmountErrMsg("mintxfee", gArgs.GetArg("-mintxfee", "")) | ||||
.translated); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
if (n > HIGH_TX_FEE_PER_KB) { | if (n > HIGH_TX_FEE_PER_KB) { | ||||
chain.initWarning( | chain.initWarning( | ||||
AmountHighWarn("-mintxfee") + " " + | AmountHighWarn("-mintxfee").translated + " " + | ||||
_("This is the minimum transaction fee you pay on " | _("This is the minimum transaction fee you pay on " | ||||
"every transaction.") | "every transaction.") | ||||
.translated); | .translated); | ||||
} | } | ||||
walletInstance->m_min_fee = CFeeRate(n); | walletInstance->m_min_fee = CFeeRate(n); | ||||
} | } | ||||
if (gArgs.IsArgSet("-fallbackfee")) { | if (gArgs.IsArgSet("-fallbackfee")) { | ||||
Amount nFeePerK = Amount::zero(); | Amount nFeePerK = Amount::zero(); | ||||
if (!ParseMoney(gArgs.GetArg("-fallbackfee", ""), nFeePerK)) { | if (!ParseMoney(gArgs.GetArg("-fallbackfee", ""), nFeePerK)) { | ||||
chain.initError(strprintf( | chain.initError(strprintf( | ||||
_("Invalid amount for -fallbackfee=<amount>: '%s'").translated, | _("Invalid amount for -fallbackfee=<amount>: '%s'").translated, | ||||
gArgs.GetArg("-fallbackfee", ""))); | gArgs.GetArg("-fallbackfee", ""))); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
if (nFeePerK > HIGH_TX_FEE_PER_KB) { | if (nFeePerK > HIGH_TX_FEE_PER_KB) { | ||||
chain.initWarning( | chain.initWarning( | ||||
AmountHighWarn("-fallbackfee") + " " + | AmountHighWarn("-fallbackfee").translated + " " + | ||||
_("This is the transaction fee you may pay when fee " | _("This is the transaction fee you may pay when fee " | ||||
"estimates are not available.") | "estimates are not available.") | ||||
.translated); | .translated); | ||||
} | } | ||||
walletInstance->m_fallback_fee = CFeeRate(nFeePerK); | walletInstance->m_fallback_fee = CFeeRate(nFeePerK); | ||||
// disable fallback fee in case value was set to 0, enable if non-null | // disable fallback fee in case value was set to 0, enable if non-null | ||||
// value | // value | ||||
walletInstance->m_allow_fallback_fee = (nFeePerK != Amount::zero()); | walletInstance->m_allow_fallback_fee = (nFeePerK != Amount::zero()); | ||||
} | } | ||||
if (gArgs.IsArgSet("-paytxfee")) { | if (gArgs.IsArgSet("-paytxfee")) { | ||||
Amount nFeePerK = Amount::zero(); | Amount nFeePerK = Amount::zero(); | ||||
if (!ParseMoney(gArgs.GetArg("-paytxfee", ""), nFeePerK)) { | if (!ParseMoney(gArgs.GetArg("-paytxfee", ""), nFeePerK)) { | ||||
chain.initError( | chain.initError( | ||||
AmountErrMsg("paytxfee", gArgs.GetArg("-paytxfee", ""))); | AmountErrMsg("paytxfee", gArgs.GetArg("-paytxfee", "")) | ||||
.translated); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
if (nFeePerK > HIGH_TX_FEE_PER_KB) { | if (nFeePerK > HIGH_TX_FEE_PER_KB) { | ||||
chain.initWarning( | chain.initWarning( | ||||
AmountHighWarn("-paytxfee") + " " + | AmountHighWarn("-paytxfee").translated + " " + | ||||
_("This is the transaction fee you will pay if you " | _("This is the transaction fee you will pay if you " | ||||
"send a transaction.") | "send a transaction.") | ||||
.translated); | .translated); | ||||
} | } | ||||
walletInstance->m_pay_tx_fee = CFeeRate(nFeePerK, 1000); | walletInstance->m_pay_tx_fee = CFeeRate(nFeePerK, 1000); | ||||
if (walletInstance->m_pay_tx_fee < chain.relayMinFee()) { | if (walletInstance->m_pay_tx_fee < chain.relayMinFee()) { | ||||
chain.initError(strprintf( | chain.initError(strprintf( | ||||
_("Invalid amount for -paytxfee=<amount>: '%s' " | _("Invalid amount for -paytxfee=<amount>: '%s' " | ||||
"(must be at least %s)") | "(must be at least %s)") | ||||
.translated, | .translated, | ||||
gArgs.GetArg("-paytxfee", ""), chain.relayMinFee().ToString())); | gArgs.GetArg("-paytxfee", ""), chain.relayMinFee().ToString())); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
} | } | ||||
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)) { | ||||
chain.initError( | chain.initError( | ||||
AmountErrMsg("maxtxfee", gArgs.GetArg("-maxtxfee", ""))); | AmountErrMsg("maxtxfee", gArgs.GetArg("-maxtxfee", "")) | ||||
.translated); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
if (nMaxFee > HIGH_MAX_TX_FEE) { | if (nMaxFee > HIGH_MAX_TX_FEE) { | ||||
chain.initWarning(_("-maxtxfee is set very high! Fees this large " | chain.initWarning(_("-maxtxfee is set very high! Fees this large " | ||||
"could be paid on a single transaction.") | "could be paid on a single transaction.") | ||||
.translated); | .translated); | ||||
} | } | ||||
if (CFeeRate(nMaxFee, 1000) < chain.relayMinFee()) { | if (CFeeRate(nMaxFee, 1000) < chain.relayMinFee()) { | ||||
chain.initError(strprintf( | chain.initError(strprintf( | ||||
_("Invalid amount for -maxtxfee=<amount>: '%s' (must be at " | _("Invalid amount for -maxtxfee=<amount>: '%s' (must be at " | ||||
"least the minrelay fee of %s to prevent stuck transactions)") | "least the minrelay fee of %s to prevent stuck transactions)") | ||||
.translated, | .translated, | ||||
gArgs.GetArg("-maxtxfee", ""), chain.relayMinFee().ToString())); | gArgs.GetArg("-maxtxfee", ""), chain.relayMinFee().ToString())); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
walletInstance->m_default_max_tx_fee = nMaxFee; | walletInstance->m_default_max_tx_fee = nMaxFee; | ||||
} | } | ||||
if (chain.relayMinFee().GetFeePerK() > HIGH_TX_FEE_PER_KB) { | if (chain.relayMinFee().GetFeePerK() > HIGH_TX_FEE_PER_KB) { | ||||
chain.initWarning( | chain.initWarning( | ||||
AmountHighWarn("-minrelaytxfee") + " " + | AmountHighWarn("-minrelaytxfee").translated + " " + | ||||
_("The wallet will avoid paying less than the minimum relay fee.") | _("The wallet will avoid paying less than the minimum relay fee.") | ||||
.translated); | .translated); | ||||
} | } | ||||
walletInstance->m_spend_zero_conf_change = | walletInstance->m_spend_zero_conf_change = | ||||
gArgs.GetBoolArg("-spendzeroconfchange", DEFAULT_SPEND_ZEROCONF_CHANGE); | gArgs.GetBoolArg("-spendzeroconfchange", DEFAULT_SPEND_ZEROCONF_CHANGE); | ||||
walletInstance->m_default_address_type = DEFAULT_ADDRESS_TYPE; | walletInstance->m_default_address_type = DEFAULT_ADDRESS_TYPE; | ||||
▲ Show 20 Lines • Show All 473 Lines • Show Last 20 Lines |