aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorAlex Morcos <morcos@chaincode.com>2016-01-05 13:11:34 -0500
committerAlex Morcos <morcos@chaincode.com>2016-01-05 13:13:23 -0500
commite420a1b15e3be8c9d862173d9d554563405b34a7 (patch)
tree13af0732d92b76ab8279d9632b797f3ce3ec7aa9 /src/init.cpp
parent995b9f385b935e4e9b9fa46e82f642204cc85cba (diff)
downloadbitcoin-e420a1b15e3be8c9d862173d9d554563405b34a7.tar.xz
Add sane fallback for fee estimation
Add new commandline option "-fallbackfee" to use when fee estimation does not have sufficient data.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index c768ca75be..ba85a7972e 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -393,6 +393,8 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageGroup(_("Wallet options:"));
strUsage += HelpMessageOpt("-disablewallet", _("Do not load the wallet and disable wallet RPC calls"));
strUsage += HelpMessageOpt("-keypool=<n>", strprintf(_("Set key pool size to <n> (default: %u)"), DEFAULT_KEYPOOL_SIZE));
+ strUsage += HelpMessageOpt("-fallbackfee=<amt>", strprintf(_("A fee rate (in %s/kB) that will be used when fee estimation has insufficient data (default: %s)"),
+ CURRENCY_UNIT, FormatMoney(DEFAULT_FALLBACK_FEE)));
strUsage += HelpMessageOpt("-mintxfee=<amt>", strprintf(_("Fees (in %s/kB) smaller than this are considered zero fee for transaction creation (default: %s)"),
CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MINFEE)));
strUsage += HelpMessageOpt("-paytxfee=<amt>", strprintf(_("Fee (in %s/kB) to add to transactions you send (default: %s)"),
@@ -947,6 +949,15 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
else
return InitError(strprintf(_("Invalid amount for -mintxfee=<amount>: '%s'"), mapArgs["-mintxfee"]));
}
+ if (mapArgs.count("-fallbackfee"))
+ {
+ CAmount nFeePerK = 0;
+ if (!ParseMoney(mapArgs["-fallbackfee"], nFeePerK))
+ return InitError(strprintf(_("Invalid amount for -fallbackfee=<amount>: '%s'"), mapArgs["-fallbackfee"]));
+ if (nFeePerK > nHighTransactionFeeWarning)
+ InitWarning(_("-fallbackfee is set very high! This is the transaction fee you may pay when fee estimates are not available."));
+ CWallet::fallbackFee = CFeeRate(nFeePerK);
+ }
if (mapArgs.count("-paytxfee"))
{
CAmount nFeePerK = 0;