diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2014-04-10 14:14:18 -0400 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2014-06-06 10:34:18 -0400 |
commit | c6cb21d17ab8097b6a425d37e48c955fbb0e9f0c (patch) | |
tree | 297b740beca0274be8a85d8c355acecafecbbc3e /src/init.cpp | |
parent | 345cb52e8ba878ca3e2590d5792b733ec11a1f0d (diff) |
Type-safe CFeeRate class
Use CFeeRate instead of an int64_t for quantities that are
fee-per-size.
Helps prevent unit-conversion mismatches between the wallet,
relaying, and mining code.
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/init.cpp b/src/init.cpp index d924bd293b..1aad679b3b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -281,8 +281,8 @@ std::string HelpMessage(HelpMessageMode hmm) strUsage += " -limitfreerelay=<n> " + _("Continuously rate-limit free transactions to <n>*1000 bytes per minute (default:15)") + "\n"; strUsage += " -maxsigcachesize=<n> " + _("Limit size of signature cache to <n> entries (default: 50000)") + "\n"; } - strUsage += " -mintxfee=<amt> " + _("Fees smaller than this are considered zero fee (for transaction creation) (default:") + " " + FormatMoney(CTransaction::nMinTxFee) + ")" + "\n"; - strUsage += " -minrelaytxfee=<amt> " + _("Fees smaller than this are considered zero fee (for relaying) (default:") + " " + FormatMoney(CTransaction::nMinRelayTxFee) + ")" + "\n"; + strUsage += " -mintxfee=<amt> " + _("Fees smaller than this are considered zero fee (for transaction creation) (default:") + " " + FormatMoney(CTransaction::minTxFee.GetFeePerK()) + ")" + "\n"; + strUsage += " -minrelaytxfee=<amt> " + _("Fees smaller than this are considered zero fee (for relaying) (default:") + " " + FormatMoney(CTransaction::minRelayTxFee.GetFeePerK()) + ")" + "\n"; strUsage += " -printtoconsole " + _("Send trace/debug info to console instead of debug.log file") + "\n"; if (GetBoolArg("-help-debug", false)) { @@ -560,7 +560,7 @@ bool AppInit2(boost::thread_group& threadGroup) { int64_t n = 0; if (ParseMoney(mapArgs["-mintxfee"], n) && n > 0) - CTransaction::nMinTxFee = n; + CTransaction::minTxFee = CFeeRate(n); else return InitError(strprintf(_("Invalid amount for -mintxfee=<amount>: '%s'"), mapArgs["-mintxfee"])); } @@ -568,7 +568,7 @@ bool AppInit2(boost::thread_group& threadGroup) { int64_t n = 0; if (ParseMoney(mapArgs["-minrelaytxfee"], n) && n > 0) - CTransaction::nMinRelayTxFee = n; + CTransaction::minRelayTxFee = CFeeRate(n); else return InitError(strprintf(_("Invalid amount for -minrelaytxfee=<amount>: '%s'"), mapArgs["-minrelaytxfee"])); } @@ -576,10 +576,12 @@ bool AppInit2(boost::thread_group& threadGroup) #ifdef ENABLE_WALLET if (mapArgs.count("-paytxfee")) { - if (!ParseMoney(mapArgs["-paytxfee"], nTransactionFee)) + int64_t nFeePerK = 0; + if (!ParseMoney(mapArgs["-paytxfee"], nFeePerK)) return InitError(strprintf(_("Invalid amount for -paytxfee=<amount>: '%s'"), mapArgs["-paytxfee"])); - if (nTransactionFee > nHighTransactionFeeWarning) + if (nFeePerK > nHighTransactionFeeWarning) InitWarning(_("Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.")); + payTxFee = CFeeRate(nFeePerK, 1000); } bSpendZeroConfChange = GetArg("-spendzeroconfchange", true); |