Merge pull request #5926 from nuttycom/deprecation/z_getbalance

Add z_get(total)balance to deprecation flags.
This commit is contained in:
Kris Nuttycombe 2022-05-09 12:52:16 -06:00 committed by GitHub
commit 7defcb8341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 2 deletions

View File

@ -45,6 +45,8 @@ default as of release 5.3.0.
conform to the `FullPrivacy` directive in all cases instead of just for conform to the `FullPrivacy` directive in all cases instead of just for
transactions involving unified addresses. transactions involving unified addresses.
- `getnewaddress` - The `getnewaddress` RPC method is deprecated. - `getnewaddress` - The `getnewaddress` RPC method is deprecated.
- `z_getbalance` - The `z_getbalance` RPC method is deprecated.
- `z_gettotalbalance` - The `z_gettotalbalance` RPC method is deprecated.
- `z_getnewaddress` - The `z_getnewaddress` RPC method is deprecated. - `z_getnewaddress` - The `z_getnewaddress` RPC method is deprecated.
- `addrtype` - The `type` attribute is deprecated in the results of RPC - `addrtype` - The `type` attribute is deprecated in the results of RPC
methods that return address metadata. It is recommended that applications methods that return address metadata. It is recommended that applications

View File

@ -37,6 +37,8 @@ be required to permit their continued use:
conform to the `FullPrivacy` directive (introduced in 4.7.0) in all cases conform to the `FullPrivacy` directive (introduced in 4.7.0) in all cases
instead of just for transactions involving unified addresses. instead of just for transactions involving unified addresses.
- `getnewaddress` - controls availability of the `getnewaddress` RPC method. - `getnewaddress` - controls availability of the `getnewaddress` RPC method.
- `z_getbalance` - controls availability of the `z_getbalance` RPC method.
- `z_gettotalbalance` - controls availability of the `z_gettotalbalance` RPC method.
- `z_getnewaddress` - controls availability of the `z_getnewaddress` RPC method. - `z_getnewaddress` - controls availability of the `z_getnewaddress` RPC method.
- `addrtype` - controls availability of the deprecated `type` attribute - `addrtype` - controls availability of the deprecated `type` attribute
returned by RPC methods that return address metadata. returned by RPC methods that return address metadata.

View File

@ -15,6 +15,8 @@
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
bool fEnableGetNewAddress = true; bool fEnableGetNewAddress = true;
bool fEnableZGetNewAddress = true; bool fEnableZGetNewAddress = true;
bool fEnableZGetBalance = true;
bool fEnableZGetTotalBalance = true;
bool fEnableLegacyPrivacyStrategy = true; bool fEnableLegacyPrivacyStrategy = true;
bool fEnableZCRawReceive = true; bool fEnableZCRawReceive = true;
bool fEnableZCRawJoinSplit = true; bool fEnableZCRawJoinSplit = true;
@ -93,6 +95,8 @@ std::optional<std::string> SetAllowedDeprecatedFeaturesFromCLIArgs() {
fEnableLegacyPrivacyStrategy = allowdeprecated.count("legacy_privacy") > 0; fEnableLegacyPrivacyStrategy = allowdeprecated.count("legacy_privacy") > 0;
fEnableGetNewAddress = allowdeprecated.count("getnewaddress") > 0; fEnableGetNewAddress = allowdeprecated.count("getnewaddress") > 0;
fEnableZGetNewAddress = allowdeprecated.count("z_getnewaddress") > 0; fEnableZGetNewAddress = allowdeprecated.count("z_getnewaddress") > 0;
fEnableZGetBalance = allowdeprecated.count("z_getbalance") > 0;
fEnableZGetTotalBalance = allowdeprecated.count("z_gettotalbalance") > 0;
fEnableZCRawReceive = allowdeprecated.count("zcrawreceive") > 0; fEnableZCRawReceive = allowdeprecated.count("zcrawreceive") > 0;
fEnableZCRawJoinSplit = allowdeprecated.count("zcrawjoinsplit") > 0; fEnableZCRawJoinSplit = allowdeprecated.count("zcrawjoinsplit") > 0;
fEnableZCRawKeygen = allowdeprecated.count("zcrawkeygen") > 0; fEnableZCRawKeygen = allowdeprecated.count("zcrawkeygen") > 0;

View File

@ -29,6 +29,8 @@ static const std::set<std::string> DEFAULT_ALLOW_DEPRECATED{{
"legacy_privacy", "legacy_privacy",
"getnewaddress", "getnewaddress",
"z_getnewaddress", "z_getnewaddress",
"z_getbalance",
"z_gettotalbalance",
"addrtype" "addrtype"
#endif #endif
}}; }};
@ -44,6 +46,8 @@ static const std::set<std::string> DEFAULT_DENY_DEPRECATED{{
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
extern bool fEnableGetNewAddress; extern bool fEnableGetNewAddress;
extern bool fEnableZGetNewAddress; extern bool fEnableZGetNewAddress;
extern bool fEnableZGetBalance;
extern bool fEnableZGetTotalBalance;
extern bool fEnableLegacyPrivacyStrategy; extern bool fEnableLegacyPrivacyStrategy;
extern bool fEnableZCRawReceive; extern bool fEnableZCRawReceive;
extern bool fEnableZCRawJoinSplit; extern bool fEnableZCRawJoinSplit;

View File

@ -4010,10 +4010,19 @@ UniValue z_getbalance(const UniValue& params, bool fHelp)
if (!EnsureWalletIsAvailable(fHelp)) if (!EnsureWalletIsAvailable(fHelp))
return NullUniValue; return NullUniValue;
if (!fEnableZGetBalance)
throw runtime_error(
"z_getbalance is DEPRECATED and will be removed in a future release\n\n"
"Use z_getbalanceforaccount, z_getbalanceforviewingkey, or getbalance (for\n"
"legacy transparent balance) instead, or restart with `-allowdeprecated=z_getbalance`\n"
"if you require backward compatibility.\n"
"See https://zcash.github.io/zcash/user/deprecation.html for more information.");
if (fHelp || params.size() == 0 || params.size() > 3) if (fHelp || params.size() == 0 || params.size() > 3)
throw runtime_error( throw runtime_error(
"z_getbalance \"address\" ( minconf inZat )\n" "z_getbalance \"address\" ( minconf inZat )\n"
"\nDEPRECATED; please use z_getbalanceforviewingkey instead.`\n" "\nDEPRECATED; please use z_getbalanceforaccount, z_getbalanceforviewingkey,\n"
"or getbalance (for legacy transparent balance) instead.\n"
"\nReturns the balance of a taddr or zaddr belonging to the node's wallet.\n" "\nReturns the balance of a taddr or zaddr belonging to the node's wallet.\n"
"\nCAUTION: If the wallet has only an incoming viewing key for this address, then spends cannot be" "\nCAUTION: If the wallet has only an incoming viewing key for this address, then spends cannot be"
"\ndetected, and so the returned balance may be larger than the actual balance." "\ndetected, and so the returned balance may be larger than the actual balance."
@ -4312,10 +4321,17 @@ UniValue z_gettotalbalance(const UniValue& params, bool fHelp)
if (!EnsureWalletIsAvailable(fHelp)) if (!EnsureWalletIsAvailable(fHelp))
return NullUniValue; return NullUniValue;
if (!fEnableZGetTotalBalance)
throw runtime_error(
"z_gettotalbalance is DEPRECATED and will be removed in a future release\n\n"
"Use z_getbalanceforaccount, or getbalance (for legacy transparent balance) instead, or\n"
"restart with `-allowdeprecated=z_gettotalbalance if you require backward compatibility.\n"
"See https://zcash.github.io/zcash/user/deprecation.html for more information.");
if (fHelp || params.size() > 2) if (fHelp || params.size() > 2)
throw runtime_error( throw runtime_error(
"z_gettotalbalance ( minconf includeWatchonly )\n" "z_gettotalbalance ( minconf includeWatchonly )\n"
"\nDEPRECATED. Please use the z_getbalanceforaccount RPC instead.\n" "\nDEPRECATED. Please use z_getbalanceforaccount or getbalance (for legacy transparent balance) instead.\n"
"\nReturn the total value of funds stored in the node's wallet.\n" "\nReturn the total value of funds stored in the node's wallet.\n"
"\nCAUTION: If the wallet contains any addresses for which it only has incoming viewing keys," "\nCAUTION: If the wallet contains any addresses for which it only has incoming viewing keys,"
"\nthe returned private balance may be larger than the actual balance, because spends cannot" "\nthe returned private balance may be larger than the actual balance, because spends cannot"