Skip to content

Commit 9ca7857

Browse files
author
Ross Nicoll
committed
Rationalize currency unit to "BTC"
Previously various user-facing strings have used inconsistent currency units "BTC", "btc" and "bitcoins". This adds a single constant and uses it for each reference to the currency unit. Also adds a description of the unit for --maxtxfee, and adds the missing "amount" field description to the (deprecated) move RPC command.
1 parent 86cfd23 commit 9ca7857

File tree

8 files changed

+48
-40
lines changed

8 files changed

+48
-40
lines changed

src/amount.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include "tinyformat.h"
99

10+
const std::string CURRENCY_UNIT = "BTC";
11+
1012
CFeeRate::CFeeRate(const CAmount& nFeePaid, size_t nSize)
1113
{
1214
if (nSize > 0)
@@ -27,5 +29,5 @@ CAmount CFeeRate::GetFee(size_t nSize) const
2729

2830
std::string CFeeRate::ToString() const
2931
{
30-
return strprintf("%d.%08d BTC/kB", nSatoshisPerK / COIN, nSatoshisPerK % COIN);
32+
return strprintf("%d.%08d %s/kB", nSatoshisPerK / COIN, nSatoshisPerK % COIN, CURRENCY_UNIT);
3133
}

src/amount.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ typedef int64_t CAmount;
1616
static const CAmount COIN = 100000000;
1717
static const CAmount CENT = 1000000;
1818

19+
extern const std::string CURRENCY_UNIT;
20+
1921
/** No amount larger than this (in satoshi) is valid.
2022
*
2123
* Note that this constant is *not* the total money supply, which in Bitcoin

src/init.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,16 +342,17 @@ std::string HelpMessage(HelpMessageMode mode)
342342
strUsage += HelpMessageOpt("-disablewallet", _("Do not load the wallet and disable wallet RPC calls"));
343343
strUsage += HelpMessageOpt("-keypool=<n>", strprintf(_("Set key pool size to <n> (default: %u)"), 100));
344344
if (showDebug)
345-
strUsage += HelpMessageOpt("-mintxfee=<amt>", strprintf("Fees (in BTC/Kb) smaller than this are considered zero fee for transaction creation (default: %s)",
346-
FormatMoney(CWallet::minTxFee.GetFeePerK())));
347-
strUsage += HelpMessageOpt("-paytxfee=<amt>", strprintf(_("Fee (in BTC/kB) to add to transactions you send (default: %s)"), FormatMoney(payTxFee.GetFeePerK())));
345+
strUsage += HelpMessageOpt("-mintxfee=<amt>", strprintf("Fees (in %s/kB) smaller than this are considered zero fee for transaction creation (default: %s)",
346+
CURRENCY_UNIT, FormatMoney(CWallet::minTxFee.GetFeePerK())));
347+
strUsage += HelpMessageOpt("-paytxfee=<amt>", strprintf(_("Fee (in %s/kB) to add to transactions you send (default: %s)"),
348+
CURRENCY_UNIT, FormatMoney(payTxFee.GetFeePerK())));
348349
strUsage += HelpMessageOpt("-rescan", _("Rescan the block chain for missing wallet transactions") + " " + _("on startup"));
349350
strUsage += HelpMessageOpt("-salvagewallet", _("Attempt to recover private keys from a corrupt wallet.dat") + " " + _("on startup"));
350351
strUsage += HelpMessageOpt("-sendfreetransactions", strprintf(_("Send transactions as zero-fee transactions if possible (default: %u)"), 0));
351352
strUsage += HelpMessageOpt("-spendzeroconfchange", strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), 1));
352353
strUsage += HelpMessageOpt("-txconfirmtarget=<n>", strprintf(_("If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)"), DEFAULT_TX_CONFIRM_TARGET));
353-
strUsage += HelpMessageOpt("-maxtxfee=<amt>", strprintf(_("Maximum total fees to use in a single wallet transaction; setting this too low may abort large transactions (default: %s)"),
354-
FormatMoney(maxTxFee)));
354+
strUsage += HelpMessageOpt("-maxtxfee=<amt>", strprintf(_("Maximum total fees (in %s) to use in a single wallet transaction; setting this too low may abort large transactions (default: %s)"),
355+
CURRENCY_UNIT, FormatMoney(maxTxFee)));
355356
strUsage += HelpMessageOpt("-upgradewallet", _("Upgrade wallet to latest format") + " " + _("on startup"));
356357
strUsage += HelpMessageOpt("-wallet=<file>", _("Specify wallet file (within data directory)") + " " + strprintf(_("(default: %s)"), "wallet.dat"));
357358
strUsage += HelpMessageOpt("-walletbroadcast", _("Make the wallet broadcast transactions") + " " + strprintf(_("(default: %u)"), true));
@@ -388,7 +389,8 @@ std::string HelpMessage(HelpMessageMode mode)
388389
strUsage += HelpMessageOpt("-relaypriority", strprintf("Require high priority for relaying free or low-fee transactions (default: %u)", 1));
389390
strUsage += HelpMessageOpt("-maxsigcachesize=<n>", strprintf("Limit size of signature cache to <n> entries (default: %u)", 50000));
390391
}
391-
strUsage += HelpMessageOpt("-minrelaytxfee=<amt>", strprintf(_("Fees (in BTC/Kb) smaller than this are considered zero fee for relaying (default: %s)"), FormatMoney(::minRelayTxFee.GetFeePerK())));
392+
strUsage += HelpMessageOpt("-minrelaytxfee=<amt>", strprintf(_("Fees (in %s/kB) smaller than this are considered zero fee for relaying (default: %s)"),
393+
CURRENCY_UNIT, FormatMoney(::minRelayTxFee.GetFeePerK())));
392394
strUsage += HelpMessageOpt("-printtoconsole", _("Send trace/debug info to console instead of debug.log file"));
393395
if (showDebug)
394396
{

src/rpcblockchain.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

6+
#include "amount.h"
67
#include "chain.h"
78
#include "chainparams.h"
89
#include "checkpoints.h"
@@ -192,7 +193,7 @@ UniValue getrawmempool(const UniValue& params, bool fHelp)
192193
"{ (json object)\n"
193194
" \"transactionid\" : { (json object)\n"
194195
" \"size\" : n, (numeric) transaction size in bytes\n"
195-
" \"fee\" : n, (numeric) transaction fee in bitcoins\n"
196+
" \"fee\" : n, (numeric) transaction fee in " + CURRENCY_UNIT + "\n"
196197
" \"time\" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT\n"
197198
" \"height\" : n, (numeric) block height when transaction entered pool\n"
198199
" \"startingpriority\" : n, (numeric) priority when transaction entered pool\n"
@@ -461,7 +462,7 @@ UniValue gettxout(const UniValue& params, bool fHelp)
461462
"{\n"
462463
" \"bestblock\" : \"hash\", (string) the block hash\n"
463464
" \"confirmations\" : n, (numeric) The number of confirmations\n"
464-
" \"value\" : x.xxx, (numeric) The transaction value in btc\n"
465+
" \"value\" : x.xxx, (numeric) The transaction value in " + CURRENCY_UNIT + "\n"
465466
" \"scriptPubKey\" : { (json object)\n"
466467
" \"asm\" : \"code\", (string) \n"
467468
" \"hex\" : \"hex\", (string) \n"

src/rpcmisc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ UniValue getinfo(const UniValue& params, bool fHelp)
6060
" \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool\n"
6161
" \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated\n"
6262
" \"unlocked_until\": ttt, (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked\n"
63-
" \"paytxfee\": x.xxxx, (numeric) the transaction fee set in btc/kb\n"
64-
" \"relayfee\": x.xxxx, (numeric) minimum relay fee for non-free transactions in btc/kb\n"
63+
" \"paytxfee\": x.xxxx, (numeric) the transaction fee set in " + CURRENCY_UNIT + "/kB\n"
64+
" \"relayfee\": x.xxxx, (numeric) minimum relay fee for non-free transactions in " + CURRENCY_UNIT + "/kB\n"
6565
" \"errors\": \"...\" (string) any error messages\n"
6666
"}\n"
6767
"\nExamples:\n"

src/rpcnet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ UniValue getnetworkinfo(const UniValue& params, bool fHelp)
423423
" }\n"
424424
" ,...\n"
425425
" ],\n"
426-
" \"relayfee\": x.xxxxxxxx, (numeric) minimum relay fee for non-free transactions in btc/kb\n"
426+
" \"relayfee\": x.xxxxxxxx, (numeric) minimum relay fee for non-free transactions in " + CURRENCY_UNIT + "/kB\n"
427427
" \"localaddresses\": [ (array) list of local addresses\n"
428428
" {\n"
429429
" \"address\": \"xxxx\", (string) network address\n"

src/rpcrawtransaction.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ UniValue getrawtransaction(const UniValue& params, bool fHelp)
149149
" ],\n"
150150
" \"vout\" : [ (array of json objects)\n"
151151
" {\n"
152-
" \"value\" : x.xxx, (numeric) The value in btc\n"
152+
" \"value\" : x.xxx, (numeric) The value in " + CURRENCY_UNIT + "\n"
153153
" \"n\" : n, (numeric) index\n"
154154
" \"scriptPubKey\" : { (json object)\n"
155155
" \"asm\" : \"asm\", (string) the asm\n"
@@ -335,7 +335,7 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
335335
" ]\n"
336336
"2. \"addresses\" (string, required) a json object with addresses as keys and amounts as values\n"
337337
" {\n"
338-
" \"address\": x.xxx (numeric, required) The key is the bitcoin address, the value is the btc amount\n"
338+
" \"address\": x.xxx (numeric, required) The key is the bitcoin address, the value is the " + CURRENCY_UNIT + " amount\n"
339339
" ,...\n"
340340
" }\n"
341341

@@ -422,7 +422,7 @@ UniValue decoderawtransaction(const UniValue& params, bool fHelp)
422422
" ],\n"
423423
" \"vout\" : [ (array of json objects)\n"
424424
" {\n"
425-
" \"value\" : x.xxx, (numeric) The value in btc\n"
425+
" \"value\" : x.xxx, (numeric) The value in " + CURRENCY_UNIT + "\n"
426426
" \"n\" : n, (numeric) index\n"
427427
" \"scriptPubKey\" : { (json object)\n"
428428
" \"asm\" : \"asm\", (string) the asm\n"

0 commit comments

Comments
 (0)