Fix some messages, comments, and documentation that:

* used "fee" to mean "fee rate", "kB" to mean 1000 bytes, "satoshis"
  to mean zatoshis, or that incorrectly used "BTC" in place of "ZEC";
* used obsolete concepts such as "zero fee" or "free transaction"; or
* did not accurately document their applicability.

Uses of "satoshis" as a JSON key are not altered.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
This commit is contained in:
Daira Emma Hopwood 2023-04-14 21:31:59 +01:00
parent 59d809cf53
commit d20a52faaa
20 changed files with 120 additions and 83 deletions

View File

@ -2,7 +2,9 @@
## zcash.conf configuration file. Lines beginning with # are comments.
##
# Network-related settings:
##
## Network-related settings
##
# Run on the test network instead of the real zcash network.
#testnet=0
@ -56,9 +58,9 @@
# Maximum number of inbound+outbound connections.
#maxconnections=
#
# JSON-RPC options (for controlling a running Zcash/zcashd process)
#
##
## JSON-RPC options (for controlling a running Zcash/zcashd process)
##
# server=1 tells zcashd to accept JSON-RPC commands (set as default if not specified)
#server=1
@ -95,15 +97,39 @@
# this option:
#rpcconnect=127.0.0.1
# Transaction Fee
##
## Transaction creation options for 'z_*' APIs.
##
# Create transactions that have enough fees so they are likely to begin confirmation within n blocks.
# This setting is overridden by the -paytxfee option.
# Set the maximum number of Orchard actions permitted in a transaction.
#orchardactionlimit=50
##
## Transaction creation options for legacy APIs (sendtoaddress, sendmany,
## and fundrawtransaction).
##
# The preferred fee rate (in ZEC per 1000 bytes) used for transactions
# created by legacy APIs. If the transaction is less than 1000 bytes then
# the fee rate is applied as though it were 1000 bytes.
#paytxfee=<amt>
# If paytxfee is not set, include enough fee that transactions created by
# legacy APIs begin confirmation on average within n blocks. This is only
# used if there is sufficient mempool data to estimate the fee; if not,
# the fallback fee set by mintxfee is used.
#txconfirmtarget=2
# Miscellaneous options
# The fallback fee rate (in ZEC per 1000 bytes) used by legacy APIs when
# paytxfee has not been set and there is insufficient mempool data to
# estimate a fee according to the txconfirmtarget option.
#mintxfee=0.00001
# Enable attempt to mine zcash.
##
## Miscellaneous options
##
# Enable attempt to CPU-mine zcash. This is only useful on testnet.
#gen=0
# Set the number of threads to be used for mining zcash (-1 = all cores).
@ -116,11 +142,3 @@
# Pre-generate this many public/private key pairs, so wallet backups will be valid for
# both prior transactions and several dozen future transactions.
#keypool=100
# Pay an optional transaction fee every time you send zcash. Transactions with fees
# are more likely than free transactions to be included in generated blocks, so may
# be validated sooner. This setting does not affect private transactions created with
# 'z_sendmany'.
#paytxfee=0.00

View File

@ -425,7 +425,7 @@ class RawTransactionsTest(BitcoinTestFramework):
mSigObj = self.nodes[2].addmultisigaddress(2, [addr1Obj['pubkey'], addr2Obj['pubkey']])
# send 1.2 BTC to msig addr
# send 1.2 ZEC to multisig address
txId = self.nodes[0].sendtoaddress(mSigObj, 1.2)
self.sync_all()
self.nodes[1].generate(1)

View File

@ -66,7 +66,7 @@ class PruneTest(BitcoinTestFramework):
self.address[0] = self.nodes[0].getnewaddress()
self.address[1] = self.nodes[1].getnewaddress()
# Determine default relay fee
# Determine default relay fee rate
self.relayfee = self.nodes[0].getnetworkinfo()["relayfee"]
connect_nodes(self.nodes[0], 1)

View File

@ -115,7 +115,7 @@ class RawTransactionsTest(BitcoinTestFramework):
#use balance deltas instead of absolute values
bal = self.nodes[2].getbalance()
# send 1.2 BTC to msig adr
# send 1.2 ZEC to multisig address
txId = self.nodes[0].sendtoaddress(mSigObj, 1.2);
self.sync_all()
self.nodes[0].generate(1)

View File

@ -258,15 +258,22 @@ Wallet options:
Set the Sapling migration address
-mintxfee=<amt>
Fees (in ZEC/kB) smaller than this are considered zero fee for
transaction creation (default: 0.00001)
The fallback fee rate (in ZEC per 1000 bytes) used by legacy APIs
(sendtoaddress, sendmany, and fundrawtransaction) when -paytxfee has not
been set and there is insufficient mempool data to estimate a fee
according to the -txconfirmtarget option (default: 0.00001)
-orchardactionlimit=<n>
Set the maximum number of Orchard actions permitted in a transaction
(default 50)
-paytxfee=<amt>
Fee (in ZEC/kB) to add to transactions you send (default: 0.00)
The preferred fee rate (in ZEC per 1000 bytes) used for transactions
created by legacy APIs (sendtoaddress, sendmany, and
fundrawtransaction). If the transaction is less than 1000 bytes then the
fee rate is applied as though it were 1000 bytes. See the descriptions
of -txconfirmtarget and -mintxfee options for how the fee is calculated
when this option is not set.
-rescan
Rescan the block chain for missing wallet transactions on startup
@ -279,8 +286,11 @@ Wallet options:
Spend unconfirmed change when sending transactions (default: 1)
-txconfirmtarget=<n>
If paytxfee is not set, include enough fee so transactions begin
confirmation on average within n blocks (default: 2)
If -paytxfee is not set, include enough fee that transactions created by
legacy APIs (sendtoaddress, sendmany, and fundrawtransaction) begin
confirmation on average within n blocks. This is only used if there is
sufficient mempool data to estimate the fee; if not, the fallback fee
set by -mintxfee is used. (default: 2)
-txexpirydelta
Set the number of blocks after which a transaction that has not been
@ -375,8 +385,9 @@ Debugging/Testing options:
Prepend debug output with timestamp (default: 1)
-minrelaytxfee=<amt>
Fees (in ZEC/kB) smaller than this are considered zero fee for relaying,
mining and transaction creation (default: 0.000001)
Transactions must have at least this fee rate (in ZEC per 1000 bytes)
for relaying, mining and transaction creation (default: 0.000001). This
is not the only fee constraint.
-maxtxfee=<amt>
Maximum total fees (in ZEC) to use in a single wallet transaction or raw

View File

@ -101,10 +101,10 @@ def rpc_port(n):
return PORT_MIN + PORT_RANGE + n + (MAX_NODES * PortSeed.n) % (PORT_RANGE - 1 - MAX_NODES)
def check_json_precision():
"""Make sure json library being used does not lose precision converting BTC values"""
"""Make sure json library being used does not lose precision converting ZEC values"""
n = Decimal("20000000.00000003")
satoshis = int(json.loads(json.dumps(float(n)))*1.0e8)
if satoshis != 2000000000000003:
zatoshis = int(json.loads(json.dumps(float(n)))*1.0e8)
if zatoshis != 2000000000000003:
raise RuntimeError("JSON encode/decode loses precision")
def bytes_to_hex_str(byte_str):

View File

@ -44,7 +44,7 @@ class TxnMallTest(BitcoinTestFramework):
# Coins are sent to node1_address
node1_address = self.nodes[1].getnewaddress("")
# First: use raw transaction API to send (starting_balance - (mining_reward - 2)) BTC to node1_address,
# First: use raw transaction API to send (starting_balance - (mining_reward - 2)) ZEC to node1_address,
# but don't broadcast:
(total_in, inputs) = gather_inputs(self.nodes[0], (starting_balance - (mining_reward - 2)))
change_address = self.nodes[0].getnewaddress("")

View File

@ -37,5 +37,5 @@ CAmount CFeeRate::GetFee(size_t nSize) const
std::string CFeeRate::ToString() const
{
return strprintf("%d.%08d %s/kB", nSatoshisPerK / COIN, nSatoshisPerK % COIN, CURRENCY_UNIT);
return strprintf("%d.%08d %s per 1000 bytes", nSatoshisPerK / COIN, nSatoshisPerK % COIN, CURRENCY_UNIT);
}

View File

@ -22,8 +22,8 @@ extern const std::string MINOR_CURRENCY_UNIT;
/** No amount larger than this (in zatoshi) is valid.
*
* Note that this constant is *not* the total money supply, which in Bitcoin
* currently happens to be less than 21,000,000 BTC for various reasons, but
* Note that this constant is *not* the total money supply, which in Zcash
* currently happens to be less than 21,000,000 ZEC for various reasons, but
* rather a sanity check. As this sanity check is used by consensus-critical
* validation code, the exact value of the MAX_MONEY constant is consensus
* critical; in unusual circumstances like a(nother) overflow bug that allowed

View File

@ -49,7 +49,7 @@
* - code = 4 (vout[1] is not spent, and 0 non-zero bytes of bitvector follow)
* - unspentness bitvector: as 0 non-zero bytes follow, it has length 0
* - vout[1]: 835800816115944e077fe7c803cfa57f29b36bf87c1d35
* * 8358: compact amount representation for 60000000000 (600 BTC)
* * 8358: compact amount representation for 60000000000 (600 ZEC)
* * 00: special txout type pay-to-pubkey-hash
* * 816115944e077fe7c803cfa57f29b36bf87c1d35: address uint160
* - height = 203998
@ -65,11 +65,11 @@
* 2 (1, +1 because both bit 2 and bit 4 are unset) non-zero bitvector bytes follow)
* - unspentness bitvector: bits 2 (0x04) and 14 (0x4000) are set, so vout[2+2] and vout[14+2] are unspent
* - vout[4]: 86ef97d5790061b01caab50f1b8e9c50a5057eb43c2d9563a4ee
* * 86ef97d579: compact amount representation for 234925952 (2.35 BTC)
* * 86ef97d579: compact amount representation for 234925952 (2.35 ZEC)
* * 00: special txout type pay-to-pubkey-hash
* * 61b01caab50f1b8e9c50a5057eb43c2d9563a4ee: address uint160
* - vout[16]: bbd123008c988f1a4a4de2161e0f50aac7f17e7f9555caa4
* * bbd123: compact amount representation for 110397 (0.001 BTC)
* * bbd123: compact amount representation for 110397 (0.001 ZEC)
* * 00: special txout type pay-to-pubkey-hash
* * 8c988f1a4a4de2161e0f50aac7f17e7f9555caa4: address uint160
* - height = 120891

View File

@ -482,7 +482,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-maxsigcachesize=<n>", strprintf("Limit total size of signature and bundle caches to <n> MiB (default: %u)", DEFAULT_MAX_SIG_CACHE_SIZE));
strUsage += HelpMessageOpt("-maxtipage=<n>", strprintf("Maximum tip age in seconds to consider node in initial block download (default: %u)", DEFAULT_MAX_TIP_AGE));
}
strUsage += HelpMessageOpt("-minrelaytxfee=<amt>", strprintf(_("Fees (in %s/kB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)"),
strUsage += HelpMessageOpt("-minrelaytxfee=<amt>", strprintf(_("Transactions must have at least this fee rate (in %s per 1000 bytes) for relaying, mining and transaction creation (default: %s). This is not the only fee constraint."),
CURRENCY_UNIT, FormatMoney(DEFAULT_MIN_RELAY_TX_FEE)));
strUsage += HelpMessageOpt("-maxtxfee=<amt>", strprintf(_("Maximum total fees (in %s) to use in a single wallet transaction or raw transaction; setting this too low may abort large transactions (default: %s)"),
CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MAXFEE)));
@ -1225,11 +1225,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
if (nConnectTimeout <= 0)
nConnectTimeout = DEFAULT_CONNECT_TIMEOUT;
// Fee-per-kilobyte amount required for mempool acceptance and relay
// If you are mining, be careful setting this:
// if you set it to zero then
// a transaction spammer can cheaply fill blocks using
// 0-fee transactions. It should be set above the real
// Fee rate in zatoshis per 1000 bytes required for mempool acceptance and relay.
// TODO(update when ZIP 317 is implemented):
// If you are mining, be careful setting this. If you set it too low then a
// transaction spammer can cheaply fill blocks. It should be set above the real
// cost to you of processing a transaction.
if (mapArgs.count("-minrelaytxfee"))
{

View File

@ -68,13 +68,13 @@ static const unsigned int MAX_REORG_LENGTH = COINBASE_MATURITY - 1;
static const bool DEFAULT_WHITELISTRELAY = true;
/** Default for DEFAULT_WHITELISTFORCERELAY. */
static const bool DEFAULT_WHITELISTFORCERELAY = true;
/** Default for -minrelaytxfee, minimum relay fee for transactions in zatoshis/kB */
/** Default for -minrelaytxfee, minimum relay fee rate for transactions in zatoshis per 1000 bytes. TODO(misnamed, this is a rate) */
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 100;
//! -maxtxfee default
/** Default for -maxtxfee in zatoshis. */
static const CAmount DEFAULT_TRANSACTION_MAXFEE = 0.1 * COIN;
//! Discourage users to set fees higher than this amount (in satoshis) per kB
/** Discourage users from setting fee rates higher than this in zatoshis per 1000 bytes. */
static const CAmount HIGH_TX_FEE_PER_KB = 0.01 * COIN;
//! -maxtxfee will warn if called with a higher fee than this amount (in satoshis)
/** Warn if -maxtxfee is set to a fee higher than this in zatoshis. */
static const CAmount HIGH_MAX_TX_FEE = 100 * HIGH_TX_FEE_PER_KB;
/** Default for -maxorphantx, maximum number of orphan transactions kept in memory */
static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100;
@ -208,9 +208,9 @@ extern bool fIBDSkipTxVerification;
// it is unneeded for testing
extern bool fCoinbaseEnforcedShieldingEnabled;
extern size_t nCoinCacheUsage;
/** A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation) */
/** Transactions must have at least this fee rate (in zatoshis per 1000 bytes) for relaying, mining and transaction creation. */
extern CFeeRate minRelayTxFee;
/** Absolute maximum transaction fee (in satoshis) used by wallet and mempool (rejects high fee in sendrawtransaction) */
/** Absolute maximum transaction fee (in zatoshis) used by wallet and mempool (rejects high fee in sendrawtransaction). */
extern CAmount maxTxFee;
extern bool fAlerts;
/** If the tip is older than this (in seconds), the node is considered to be in initial block download. */

View File

@ -372,7 +372,7 @@ UniValue getmininginfo(const UniValue& params, bool fHelp)
}
// NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts
// NOTE: Unlike wallet RPCs (which use ZEC values), mining RPCs follow GBT (BIP 22) in using zatoshi amounts.
UniValue prioritisetransaction(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 2)
@ -471,7 +471,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
" n (numeric) transactions before this one (by 1-based index in 'transactions' list) that must be present in the final block if this one is\n"
" ,...\n"
" ],\n"
" \"fee\": n, (numeric) difference in value between transaction inputs and outputs (in Satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one\n"
" \"fee\": n, (numeric) difference in value between transaction inputs and outputs (in " + MINOR_CURRENCY_UNIT + "); for coinbase transactions, this is a negative Number of the total collected block fees (i.e., not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn't one\n"
" \"sigops\" : n, (numeric) total number of SigOps, as counted for purposes of block limits; if key is not present, sigop count is unknown and clients MUST NOT assume there aren't any\n"
" \"required\" : true|false (boolean) if provided and true, this transaction must be in the final block\n"
" }\n"
@ -480,7 +480,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
// " \"coinbaseaux\" : { (json object) data that should be included in the coinbase's scriptSig content\n"
// " \"flags\" : \"flags\" (string) \n"
// " },\n"
// " \"coinbasevalue\" : n, (numeric) maximum allowable input to coinbase transaction, including the generation award and transaction fees (in Satoshis)\n"
// " \"coinbasevalue\" : n, (numeric) maximum allowable input to coinbase transaction, including the generation award and transaction fees (in " + MINOR_CURRENCY_UNIT + ")\n"
" \"coinbasetxn\" : { ... }, (json object) information for coinbase transaction\n"
" \"target\" : \"xxxx\", (string) The hash target\n"
" \"longpollid\" : \"str\", (string) an id to include with a request to longpoll on an update to this template\n"

View File

@ -67,8 +67,8 @@ UniValue getinfo(const UniValue& params, bool fHelp)
" \"keypoololdest\": xxxxxx, (numeric, optional) the timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool, if wallet functionality is enabled\n"
" \"keypoolsize\": xxxx, (numeric, optional) how many new keys are pre-generated\n"
" \"unlocked_until\": ttt, (numeric, optional) 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, if wallet functionality is available and the wallet is encrypted\n"
" \"paytxfee\": x.xxxx, (numeric) the transaction fee set in " + CURRENCY_UNIT + "/kB\n"
" \"relayfee\": x.xxxx, (numeric) minimum relay fee for transactions in " + CURRENCY_UNIT + "/kB\n"
" \"paytxfee\": x.xxxx, (numeric) the transaction fee rate set in " + CURRENCY_UNIT + " per 1000 bytes\n"
" \"relayfee\": x.xxxx, (numeric) minimum relay fee rate for transactions in " + CURRENCY_UNIT + " per 1000 bytes\n"
" \"errors\": \"...\" (string) message describing the latest or highest-priority error\n"
" \"errorstimestamp\": \"...\" (string) timestamp associated with the latest or highest-priority error\n"
"}\n"
@ -661,7 +661,7 @@ UniValue getaddressmempool(const UniValue& params, bool fHelp)
" \"address\" (string) The base58check encoded address\n"
" \"txid\" (string) The related txid\n"
" \"index\" (number) The related input or output index\n"
" \"satoshis\" (number) The difference of zatoshis\n"
" \"satoshis\" (number) The difference of " + MINOR_CURRENCY_UNIT + "\n"
" \"timestamp\" (number) The time the transaction entered the mempool (seconds)\n"
" \"prevtxid\" (string) The previous txid (if spending)\n"
" \"prevout\" (string) The previous transaction output index (if spending)\n"
@ -743,7 +743,7 @@ UniValue getaddressutxos(const UniValue& params, bool fHelp)
" \"height\" (number) The block height\n"
" \"outputIndex\" (number) The output index\n"
" \"script\" (string) The script hex encoded\n"
" \"satoshis\" (number) The number of zatoshis of the output\n"
" \"satoshis\" (number) The number of " + MINOR_CURRENCY_UNIT + " of the output\n"
" }, ...\n"
"]\n\n"
"(or, if chainInfo is true):\n\n"
@ -756,7 +756,7 @@ UniValue getaddressutxos(const UniValue& params, bool fHelp)
" \"height\" (number) The block height\n"
" \"outputIndex\" (number) The output index\n"
" \"script\" (string) The script hex encoded\n"
" \"satoshis\" (number) The number of zatoshis of the output\n"
" \"satoshis\" (number) The number of " + MINOR_CURRENCY_UNIT + " of the output\n"
" }, ...\n"
" ],\n"
" \"hash\" (string) The block hash\n"
@ -899,7 +899,7 @@ UniValue getaddressdeltas(const UniValue& params, bool fHelp)
"\nResult:\n"
"[\n"
" {\n"
" \"satoshis\" (number) The difference of zatoshis\n"
" \"satoshis\" (number) The difference of " + MINOR_CURRENCY_UNIT + "\n"
" \"txid\" (string) The related txid\n"
" \"index\" (number) The related input or output index\n"
" \"height\" (number) The block height\n"
@ -911,7 +911,7 @@ UniValue getaddressdeltas(const UniValue& params, bool fHelp)
" \"deltas\":\n"
" [\n"
" {\n"
" \"satoshis\" (number) The difference of zatoshis\n"
" \"satoshis\" (number) The difference of " + MINOR_CURRENCY_UNIT + "\n"
" \"txid\" (string) The related txid\n"
" \"index\" (number) The related input or output index\n"
" \"height\" (number) The block height\n"
@ -1022,8 +1022,8 @@ UniValue getaddressbalance(const UniValue& params, bool fHelp)
"\"address\" (string) The base58check encoded address\n"
"\nResult:\n"
"{\n"
" \"balance\" (string) The current balance in zatoshis\n"
" \"received\" (string) The total number of zatoshis received (including change)\n"
" \"balance\" (string) The current balance in " + MINOR_CURRENCY_UNIT + "\n"
" \"received\" (string) The total number of " + MINOR_CURRENCY_UNIT + " received (including change)\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("getaddressbalance", "'{\"addresses\": [\"tmYXBYJj1K7vhejSec5osXK2QsGa5MTisUQ\"]}'")

View File

@ -516,7 +516,7 @@ UniValue getnetworkinfo(const UniValue& params, bool fHelp)
" }\n"
" ,...\n"
" ],\n"
" \"relayfee\": x.xxxxxxxx, (numeric) minimum relay fee for transactions in " + CURRENCY_UNIT + "/kB\n"
" \"relayfee\": x.xxxxxxxx, (numeric) minimum relay fee rate for transactions in " + CURRENCY_UNIT + " per 1000 bytes\n"
" \"localaddresses\": [ (array) list of local addresses\n"
" {\n"
" \"address\": \"xxxx\", (string) network address\n"

View File

@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE(json_parse_errors)
// Invalid, trailing garbage
BOOST_CHECK(!ParseNonRFCJSONValue("1.0sds").has_value());
BOOST_CHECK(!ParseNonRFCJSONValue("1.0]").has_value());
// BTC addresses should fail parsing
// Bitcoin addresses should fail parsing
BOOST_CHECK(!ParseNonRFCJSONValue("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W").has_value());
BOOST_CHECK(!ParseNonRFCJSONValue("3J98t1WpEZ73CNmQviecrnyiWrnqRhWNL").has_value());
}

View File

@ -2408,9 +2408,9 @@ UniValue settxfee(const UniValue& params, bool fHelp)
if (fHelp || params.size() < 1 || params.size() > 1)
throw runtime_error(
"settxfee amount\n"
"\nSet the transaction fee per kB. Overwrites the paytxfee parameter.\n"
"\nSet the preferred transaction fee rate per 1000 bytes. This is only used by legacy transaction creation APIs (sendtoaddress, sendmany, and fundrawtransaction). Overwrites the paytxfee parameter.\n"
"\nArguments:\n"
"1. amount (numeric, required) The transaction fee in " + CURRENCY_UNIT + "/kB rounded to the nearest 0.00000001\n"
"1. amount (numeric, required) The transaction fee rate in " + CURRENCY_UNIT + " per 1000 bytes rounded to the nearest 0.00000001\n"
"\nResult\n"
"true|false (boolean) Returns true if successful\n"
"\nExamples:\n"
@ -2454,7 +2454,7 @@ UniValue getwalletinfo(const UniValue& params, bool fHelp)
" \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool\n"
" \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated\n"
" \"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"
" \"paytxfee\": x.xxxx, (numeric) the transaction fee configuration, set in " + CURRENCY_UNIT + "/kB\n"
" \"paytxfee\": x.xxxx, (numeric) the preferred transaction fee rate used for transactions created by legacy APIs, set in " + CURRENCY_UNIT + " per 1000 bytes\n"
" \"mnemonic_seedfp\": \"uint256\", (string) the BLAKE2b-256 hash of the HD seed derived from the wallet's emergency recovery phrase\n"
" \"legacy_seedfp\": \"uint256\", (string, optional) if this wallet was created prior to release 4.5.2, this will contain the BLAKE2b-256\n"
" hash of the legacy HD seed that was used to derive Sapling addresses prior to the 4.5.2 upgrade to mnemonic\n"
@ -4260,7 +4260,7 @@ UniValue z_viewtransaction(const UniValue& params, bool fHelp)
" \"actionPrev\" : n, (numeric, orchard) the index of the action within the orchard bundle\n"
" \"address\" : \"zcashaddress\", (string) The Zcash address involved in the transaction\n"
" \"value\" : x.xxx (numeric) The amount in " + CURRENCY_UNIT + "\n"
" \"valueZat\" : xxxx (numeric) The amount in zatoshis\n"
" \"valueZat\" : xxxx (numeric) The amount in " + MINOR_CURRENCY_UNIT + "\n"
" }\n"
" ,...\n"
" ],\n"
@ -4276,7 +4276,7 @@ UniValue z_viewtransaction(const UniValue& params, bool fHelp)
" \"outgoing\" : true|false (boolean) True if the output is not for an address in the wallet\n"
" \"walletInternal\" : true|false (boolean) True if this is a change output.\n"
" \"value\" : x.xxx (numeric) The amount in " + CURRENCY_UNIT + "\n"
" \"valueZat\" : xxxx (numeric) The amount in zatoshis\n"
" \"valueZat\" : xxxx (numeric) The amount in " + MINOR_CURRENCY_UNIT + "\n"
" \"memo\" : \"hexmemo\", (string) hexadecimal string representation of the memo field\n"
" \"memoStr\" : \"memo\", (string) Only returned if memo contains valid UTF-8 text.\n"
" }\n"

View File

@ -175,11 +175,11 @@ BOOST_AUTO_TEST_CASE(coin_selection_tests)
add_coin( 3*COIN);
add_coin( 4*COIN); // now we have 5+6+7+8+18+20+30+100+200+300+400 = 1094 cents
BOOST_CHECK( CWallet::SelectCoinsMinConf(95 * CENT, 1, 1, vCoins, setCoinsRet, nValueRet));
BOOST_CHECK_EQUAL(nValueRet, 1 * COIN); // we should get 1 BTC in 1 coin
BOOST_CHECK_EQUAL(nValueRet, 1 * COIN); // we should get 1 ZEC in 1 coin
BOOST_CHECK_EQUAL(setCoinsRet.size(), 1U);
BOOST_CHECK( CWallet::SelectCoinsMinConf(195 * CENT, 1, 1, vCoins, setCoinsRet, nValueRet));
BOOST_CHECK_EQUAL(nValueRet, 2 * COIN); // we should get 2 BTC in 1 coin
BOOST_CHECK_EQUAL(nValueRet, 2 * COIN); // we should get 2 ZEC in 1 coin
BOOST_CHECK_EQUAL(setCoinsRet.size(), 1U);
// empty the wallet and start again, now with fractions of a cent, to test small change avoidance

View File

@ -56,8 +56,9 @@ unsigned int nOrchardActionLimit = DEFAULT_ORCHARD_ACTION_LIMIT;
const char * DEFAULT_WALLET_DAT = "wallet.dat";
/**
* Fees smaller than this (in satoshi) are considered zero fee (for transaction creation)
* Override with -mintxfee
* -mintxfee: the fallback fee rate (in ZEC per 1000 bytes) used by legacy APIs
* when -paytxfee has not been set and there is insufficient mempool data to
* estimate a fee according to the -txconfirmtarget option.
*/
CFeeRate CWallet::minTxFee = CFeeRate(DEFAULT_TRANSACTION_MINFEE);
@ -5808,7 +5809,9 @@ CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarge
{
// payTxFee is user-set "I want to pay this much"
CAmount nFeeNeeded = payTxFee.GetFee(nTxBytes);
// user selected total at least (default=true)
// TODO: fPayAtLeastCustomFee is always true so we could simplify this by saying
// `payTxFee.GetFee(std::max(1000, nTxBytes))` above, if we do not remove this code
// completely.
if (fPayAtLeastCustomFee && nFeeNeeded > 0 && nFeeNeeded < payTxFee.GetFeePerK())
nFeeNeeded = payTxFee.GetFeePerK();
// User didn't set: use -txconfirmtarget to estimate...
@ -6503,15 +6506,21 @@ std::string CWallet::GetWalletHelpString(bool showDebug)
strUsage += HelpMessageOpt("-keypool=<n>", strprintf(_("Set key pool size to <n> (default: %u)"), DEFAULT_KEYPOOL_SIZE));
strUsage += HelpMessageOpt("-migration", _("Enable the Sprout to Sapling migration"));
strUsage += HelpMessageOpt("-migrationdestaddress=<zaddr>", _("Set the Sapling migration address"));
strUsage += HelpMessageOpt("-mintxfee=<amt>", strprintf(_("Fees (in %s/kB) smaller than this are considered zero fee for transaction creation (default: %s)"),
strUsage += HelpMessageOpt("-mintxfee=<amt>", strprintf(_("The fallback fee rate (in %s per 1000 bytes) used by legacy APIs (sendtoaddress, sendmany, and fundrawtransaction) when -paytxfee "
"has not been set and there is insufficient mempool data to estimate a fee according to the -txconfirmtarget option (default: %s)"),
CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MINFEE)));
strUsage += HelpMessageOpt("-orchardactionlimit=<n>", strprintf(_("Set the maximum number of Orchard actions permitted in a transaction (default %u)"), DEFAULT_ORCHARD_ACTION_LIMIT));
strUsage += HelpMessageOpt("-paytxfee=<amt>", strprintf(_("Fee (in %s/kB) to add to transactions you send (default: %s)"),
CURRENCY_UNIT, FormatMoney(payTxFee.GetFeePerK())));
strUsage += HelpMessageOpt("-paytxfee=<amt>", strprintf(_("The preferred fee rate (in %s per 1000 bytes) used for transactions created by legacy APIs (sendtoaddress, sendmany, and fundrawtransaction). "
"If the transaction is less than 1000 bytes then the fee rate is applied as though it were 1000 bytes. See the descriptions of -txconfirmtarget "
"and -mintxfee options for how the fee is calculated when this option is not set."),
CURRENCY_UNIT));
strUsage += HelpMessageOpt("-rescan", _("Rescan the block chain for missing wallet transactions on startup"));
strUsage += HelpMessageOpt("-salvagewallet", _("Attempt to recover private keys from a corrupt wallet on startup (implies -rescan)"));
strUsage += HelpMessageOpt("-spendzeroconfchange", strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), DEFAULT_SPEND_ZEROCONF_CHANGE));
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));
strUsage += HelpMessageOpt("-txconfirmtarget=<n>", strprintf(_("If -paytxfee is not set, include enough fee that transactions created by legacy APIs (sendtoaddress, sendmany, and fundrawtransaction) "
"begin confirmation on average within n blocks. This is only used if there is sufficient mempool data to estimate the fee; if not, the "
"fallback fee set by -mintxfee is used. (default: %u)"),
DEFAULT_TX_CONFIRM_TARGET));
strUsage += HelpMessageOpt("-txexpirydelta", strprintf(_("Set the number of blocks after which a transaction that has not been mined will become invalid (min: %u, default: %u (pre-Blossom) or %u (post-Blossom))"), TX_EXPIRING_SOON_THRESHOLD + 1, DEFAULT_PRE_BLOSSOM_TX_EXPIRY_DELTA, DEFAULT_POST_BLOSSOM_TX_EXPIRY_DELTA));
strUsage += HelpMessageOpt("-upgradewallet", _("Upgrade wallet to latest format on startup"));
strUsage += HelpMessageOpt("-wallet=<file>", _("Specify wallet file absolute path or a path relative to the data directory") + " " + strprintf(_("(default: %s)"), DEFAULT_WALLET_DAT));
@ -6728,11 +6737,11 @@ bool CWallet::ParameterInteraction(const CChainParams& params)
if (!ParseMoney(mapArgs["-paytxfee"], nFeePerK))
return UIError(AmountErrMsg("paytxfee", mapArgs["-paytxfee"]));
if (nFeePerK > HIGH_TX_FEE_PER_KB)
UIWarning(_("-paytxfee is set very high! This is the transaction fee you will pay if you send a transaction."));
UIWarning(_("-paytxfee is set to a very high fee rate! This is the fee rate you will pay if you send a transaction."));
payTxFee = CFeeRate(nFeePerK, 1000);
if (payTxFee < ::minRelayTxFee)
{
return UIError(strprintf(_("Invalid amount for -paytxfee=<amount>: '%s' (must be at least %s)"),
return UIError(strprintf(_("Invalid amount for -paytxfee=<amount>: '%s' (must be at least the minimum relay fee rate %s)"),
mapArgs["-paytxfee"], ::minRelayTxFee.ToString()));
}
}
@ -6742,11 +6751,11 @@ bool CWallet::ParameterInteraction(const CChainParams& params)
if (!ParseMoney(mapArgs["-maxtxfee"], nMaxFee))
return UIError(AmountErrMsg("maxtxfee", mapArgs["-maxtxfee"]));
if (nMaxFee > HIGH_MAX_TX_FEE)
UIWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
UIWarning(_("-maxtxfee is set to a very high fee rate! Fee rates this large could be paid on a single transaction."));
maxTxFee = nMaxFee;
if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFee)
{
return UIError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"),
return UIError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minimum relay fee rate of %s to prevent stuck transactions)"),
mapArgs["-maxtxfee"], ::minRelayTxFee.ToString()));
}
}

View File

@ -1947,12 +1947,12 @@ public:
static CFeeRate minTxFee;
/**
* Estimate the minimum fee considering user set parameters
* and the required fee
* and the required fee.
*/
static CAmount GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool);
/**
* Return the minimum required fee taking into account the
* floating relay fee and user set minimum transaction fee
* floating relay fee rate and user set minimum transaction fee rate.
*/
static CAmount GetRequiredFee(unsigned int nTxBytes);