Deprecate `getrawchangeaddress` and `z_listaddresses`

This commit is contained in:
Kris Nuttycombe 2022-05-10 14:22:12 -06:00
parent c6ceeb1646
commit 721e5d85ab
5 changed files with 28 additions and 1 deletions

View File

@ -45,9 +45,11 @@ default as of release 5.3.0.
conform to the `FullPrivacy` directive in all cases instead of just for
transactions involving unified addresses.
- `getnewaddress` - The `getnewaddress` RPC method is deprecated.
- `getrawchangeaddress` - The `getrawchangeaddress` 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_listaddresses` - The `z_listaddresses` RPC method is deprecated.
- `addrtype` - The `type` attribute is deprecated in the results of RPC
methods that return address metadata. It is recommended that applications
using this metadata be updated to use the `pool` or `address_type`

View File

@ -37,9 +37,11 @@ be required to permit their continued use:
conform to the `FullPrivacy` directive (introduced in 4.7.0) in all cases
instead of just for transactions involving unified addresses.
- `getnewaddress` - controls availability of the `getnewaddress` RPC method.
- `getrawchangeaddress` - controls availability of the `getrawchangeaddress` 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_listaddresses` - controls availability of the `z_listaddresses` RPC method.
- `addrtype` - controls availability of the deprecated `type` attribute
returned by RPC methods that return address metadata.

View File

@ -14,9 +14,11 @@
// Flags that enable deprecated functionality.
#ifdef ENABLE_WALLET
bool fEnableGetNewAddress = true;
bool fEnableGetRawChangeAddress = true;
bool fEnableZGetNewAddress = true;
bool fEnableZGetBalance = true;
bool fEnableZGetTotalBalance = true;
bool fEnableZListAddresses = true;
bool fEnableLegacyPrivacyStrategy = true;
bool fEnableZCRawReceive = true;
bool fEnableZCRawJoinSplit = true;
@ -94,9 +96,11 @@ std::optional<std::string> SetAllowedDeprecatedFeaturesFromCLIArgs() {
#ifdef ENABLE_WALLET
fEnableLegacyPrivacyStrategy = allowdeprecated.count("legacy_privacy") > 0;
fEnableGetNewAddress = allowdeprecated.count("getnewaddress") > 0;
fEnableGetRawChangeAddress = allowdeprecated.count("getrawchangeaddress") > 0;
fEnableZGetNewAddress = allowdeprecated.count("z_getnewaddress") > 0;
fEnableZGetBalance = allowdeprecated.count("z_getbalance") > 0;
fEnableZGetTotalBalance = allowdeprecated.count("z_gettotalbalance") > 0;
fEnableZListAddresses = allowdeprecated.count("z_listaddresses") > 0;
fEnableZCRawReceive = allowdeprecated.count("zcrawreceive") > 0;
fEnableZCRawJoinSplit = allowdeprecated.count("zcrawjoinsplit") > 0;
fEnableZCRawKeygen = allowdeprecated.count("zcrawkeygen") > 0;

View File

@ -28,9 +28,11 @@ static const std::set<std::string> DEFAULT_ALLOW_DEPRECATED{{
#ifdef ENABLE_WALLET
"legacy_privacy",
"getnewaddress",
"getrawchangeaddress",
"z_getnewaddress",
"z_getbalance",
"z_gettotalbalance",
"z_listaddresses",
"addrtype"
#endif
}};
@ -45,9 +47,11 @@ static const std::set<std::string> DEFAULT_DENY_DEPRECATED{{
// Flags that enable deprecated functionality.
#ifdef ENABLE_WALLET
extern bool fEnableGetNewAddress;
extern bool fEnableGetRawChangeAddress;
extern bool fEnableZGetNewAddress;
extern bool fEnableZGetBalance;
extern bool fEnableZGetTotalBalance;
extern bool fEnableZListAddresses;
extern bool fEnableLegacyPrivacyStrategy;
extern bool fEnableZCRawReceive;
extern bool fEnableZCRawJoinSplit;

View File

@ -210,6 +210,14 @@ UniValue getrawchangeaddress(const UniValue& params, bool fHelp)
if (!EnsureWalletIsAvailable(fHelp))
return NullUniValue;
if (!fEnableGetRawChangeAddress)
throw runtime_error(
"getrawchangeaddress is DEPRECATED and will be removed in a future release\n"
"\nChange addresses are a wallet-internal feature. Use a unified address for\n"
"a dedicated change account instead, or restart with `-allowdeprecated=getrawchangeaddress` \n"
"if you require backward compatibility.\n"
"See https://zcash.github.io/zcash/user/deprecation.html for more information.");
if (fHelp || params.size() > 1)
throw runtime_error(
"getrawchangeaddress\n"
@ -3573,10 +3581,17 @@ UniValue z_listaddresses(const UniValue& params, bool fHelp)
if (!EnsureWalletIsAvailable(fHelp))
return NullUniValue;
if (!fEnableZListAddresses)
throw runtime_error(
"z_listaddresses is DEPRECATED and will be removed in a future release\n"
"\nUse listaddresses or restart with `-allowdeprecated=z_listaddresses`\n"
"if you require backward compatibility.\n"
"See https://zcash.github.io/zcash/user/deprecation.html for more information.");
if (fHelp || params.size() > 1)
throw runtime_error(
"z_listaddresses ( includeWatchonly )\n"
"\nDEPRECATED\n"
"\nDEPRECATED. Use `listaddresses` instead.\n"
"\nReturns the list of shielded addresses belonging to the wallet.\n"
"\nThis never returns Unified Addresses; see 'listaddresses' for them.\n"
"\nArguments:\n"