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:
commit
0a901b06eb
|
@ -26,7 +26,7 @@ WEIGHT_RATIO_CAP = 4
|
||||||
|
|
||||||
# The zcashd RPC sentinel value to indicate the conventional_fee when a positional argument is
|
# The zcashd RPC sentinel value to indicate the conventional_fee when a positional argument is
|
||||||
# required.
|
# required.
|
||||||
ZIP_317_FEE = -1
|
ZIP_317_FEE = None
|
||||||
|
|
||||||
def conventional_fee_zats(logical_actions):
|
def conventional_fee_zats(logical_actions):
|
||||||
return MARGINAL_FEE * max(GRACE_ACTIONS, logical_actions)
|
return MARGINAL_FEE * max(GRACE_ACTIONS, logical_actions)
|
||||||
|
|
|
@ -309,8 +309,7 @@ class WalletShieldingCoinbaseTest (BitcoinTestFramework):
|
||||||
|
|
||||||
# Send will fail because fee is negative
|
# Send will fail because fee is negative
|
||||||
try:
|
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, -1)
|
||||||
self.nodes[0].z_sendmany(myzaddr, recipients, 1, -2)
|
|
||||||
except JSONRPCException as e:
|
except JSONRPCException as e:
|
||||||
errorString = e.error['message']
|
errorString = e.error['message']
|
||||||
assert_equal("Amount out of range" in errorString, True)
|
assert_equal("Amount out of range" in errorString, True)
|
||||||
|
|
|
@ -4808,7 +4808,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
|
||||||
" the output is being sent to a transparent address, it’s an error to include this field.\n"
|
" the output is being sent to a transparent address, it’s an error to include this field.\n"
|
||||||
" }, ... ]\n"
|
" }, ... ]\n"
|
||||||
"3. minconf (numeric, optional, default=" + strprintf("%u", DEFAULT_NOTE_CONFIRMATIONS) + ") Only use funds confirmed at least this many times.\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"
|
" 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"
|
"5. privacyPolicy (string, optional, default=\"LegacyCompat\") Policy for what information leakage is acceptable.\n"
|
||||||
" One of the following strings:\n"
|
" One of the following strings:\n"
|
||||||
|
@ -4835,6 +4835,8 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
|
||||||
"\nExamples:\n"
|
"\nExamples:\n"
|
||||||
+ HelpExampleCli("z_sendmany", "\"t1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" '[{\"address\": \"ztfaW34Gj9FrnGUEf833ywDVL62NWXBM81u6EQnM6VR45eYnXhwztecW1SjxA7JrmAXKJhxhj3vDNEpVCQoSvVoSpmbhtjf\", \"amount\": 5.0}]'")
|
+ 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}]'")
|
||||||
|
+ 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}]")
|
+ 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);
|
int nMinDepth = parseMinconf(DEFAULT_NOTE_CONFIRMATIONS, params, 2, std::nullopt);
|
||||||
|
|
||||||
std::optional<CAmount> nFee;
|
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] );
|
nFee = AmountFromValue( params[3] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue