mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
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.
This commit is contained in:
14
src/init.cpp
14
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user