aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-12-23 12:06:30 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2014-12-23 12:12:05 +0100
commitd01bcc446ea969b5213b8795566bd6d88f288545 (patch)
treecef4bed6062135a19d63f03f1e34d39418fc9a88 /src/init.cpp
parent4406c3e0f44ef037f884cc1a1583ef83e09189ea (diff)
parentaa279d613152e87ea25edfdf76c86779c0632f18 (diff)
downloadbitcoin-d01bcc446ea969b5213b8795566bd6d88f288545.tar.xz
Merge pull request #5485
aa279d6 Enforce minRelayTxFee on wallet created tx and add a maxtxfee option. (Gregory Maxwell)
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 22026c4468..13a7192a73 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -287,6 +287,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += " -sendfreetransactions " + strprintf(_("Send transactions as zero-fee transactions if possible (default: %u)"), 0) + "\n";
strUsage += " -spendzeroconfchange " + strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), 1) + "\n";
strUsage += " -txconfirmtarget=<n> " + strprintf(_("If paytxfee is not set, include enough fee so transactions are confirmed on average within n blocks (default: %u)"), 1) + "\n";
+ strUsage += " -maxtxfee=<amt> " + strprintf(_("Maximum total fees to use in a single wallet transaction, setting too low may abort large transactions (default: %s)"), FormatMoney(maxTxFee)) + "\n";
strUsage += " -upgradewallet " + _("Upgrade wallet to latest format") + " " + _("on startup") + "\n";
strUsage += " -wallet=<file> " + _("Specify wallet file (within data directory)") + " " + strprintf(_("(default: %s)"), "wallet.dat") + "\n";
strUsage += " -walletnotify=<cmd> " + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n";
@@ -696,6 +697,20 @@ bool AppInit2(boost::thread_group& threadGroup)
mapArgs["-paytxfee"], ::minRelayTxFee.ToString()));
}
}
+ if (mapArgs.count("-maxtxfee"))
+ {
+ CAmount nMaxFee = 0;
+ if (!ParseMoney(mapArgs["-maxtxfee"], nMaxFee))
+ return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s'"), mapArgs["-maptxfee"]));
+ if (nMaxFee > nHighTransactionMaxFeeWarning)
+ InitWarning(_("Warning: -maxtxfee is set very high! Fees this large could be paid on a single transaction."));
+ maxTxFee = nMaxFee;
+ if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFee)
+ {
+ return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"),
+ mapArgs["-maxtxfee"], ::minRelayTxFee.ToString()));
+ }
+ }
nTxConfirmTarget = GetArg("-txconfirmtarget", 1);
bSpendZeroConfChange = GetArg("-spendzeroconfchange", true);
fSendFreeTransactions = GetArg("-sendfreetransactions", false);