Merge pull request #6559 from sellout/conventional-fee-sentinel

Use null as the ZIP 317 fee sentinel instead of -1
This commit is contained in:
Kris Nuttycombe 2023-04-15 22:24:09 -06:00 committed by GitHub
commit 0a901b06eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -26,7 +26,7 @@ WEIGHT_RATIO_CAP = 4
# The zcashd RPC sentinel value to indicate the conventional_fee when a positional argument is
# required.
ZIP_317_FEE = -1
ZIP_317_FEE = None
def conventional_fee_zats(logical_actions):
return MARGINAL_FEE * max(GRACE_ACTIONS, logical_actions)

View File

@ -309,8 +309,7 @@ class WalletShieldingCoinbaseTest (BitcoinTestFramework):
# Send will fail because fee is negative
try:
# NB: Using -2 as the fee because -1 is the sentinel for using the conventional fee.
self.nodes[0].z_sendmany(myzaddr, recipients, 1, -2)
self.nodes[0].z_sendmany(myzaddr, recipients, 1, -1)
except JSONRPCException as e:
errorString = e.error['message']
assert_equal("Amount out of range" in errorString, True)

View File

@ -4808,7 +4808,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
" the output is being sent to a transparent address, its an error to include this field.\n"
" }, ... ]\n"
"3. minconf (numeric, optional, default=" + strprintf("%u", DEFAULT_NOTE_CONFIRMATIONS) + ") Only use funds confirmed at least this many times.\n"
"4. fee (numeric, optional, default=-1) The fee amount in " + CURRENCY_UNIT + " to attach to this transaction. The default behavior\n"
"4. fee (numeric, optional, default=null) The fee amount in " + CURRENCY_UNIT + " to attach to this transaction. The default behavior\n"
" is to use a fee calculated according to ZIP 317.\n"
"5. privacyPolicy (string, optional, default=\"LegacyCompat\") Policy for what information leakage is acceptable.\n"
" One of the following strings:\n"
@ -4835,6 +4835,8 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
"\nExamples:\n"
+ HelpExampleCli("z_sendmany", "\"t1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" '[{\"address\": \"ztfaW34Gj9FrnGUEf833ywDVL62NWXBM81u6EQnM6VR45eYnXhwztecW1SjxA7JrmAXKJhxhj3vDNEpVCQoSvVoSpmbhtjf\", \"amount\": 5.0}]'")
+ HelpExampleCli("z_sendmany", "\"ANY_TADDR\" '[{\"address\": \"t1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", \"amount\": 2.0}]'")
+ HelpExampleCli("z_sendmany", "\"ANY_TADDR\" '[{\"address\": \"t1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", \"amount\": 2.0}]' 1 null 'AllowFullyTransparent'")
+ HelpExampleCli("z_sendmany", "\"ANY_TADDR\" '[{\"address\": \"t1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", \"amount\": 2.0}]' 1 5000")
+ HelpExampleRpc("z_sendmany", "\"t1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", [{\"address\": \"ztfaW34Gj9FrnGUEf833ywDVL62NWXBM81u6EQnM6VR45eYnXhwztecW1SjxA7JrmAXKJhxhj3vDNEpVCQoSvVoSpmbhtjf\", \"amount\": 5.0}]")
);
@ -5012,7 +5014,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
int nMinDepth = parseMinconf(DEFAULT_NOTE_CONFIRMATIONS, params, 2, std::nullopt);
std::optional<CAmount> nFee;
if (params.size() > 3 && params[3].get_real() != -1.0) {
if (params.size() > 3 && !params[3].isNull()) {
nFee = AmountFromValue( params[3] );
}