Merge pull request #5975 from nuttycom/deprecation/disable_dumpwallet

Mark the `dumpwallet` RPC method as disabled.

Admin merge requested by @str4d
This commit is contained in:
sasha 2022-05-26 17:31:02 -07:00 committed by GitHub
commit aad3da4d3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 2 deletions

View File

@ -69,3 +69,10 @@ The following features are disabled by default, and will be removed in release 5
- `zcrawreceive` - The `zcrawreceive` RPC method is disabled.
- `zcrawjoinsplit` - The `zcrawjoinsplit` RPC method is disabled.
- `zcrawkeygen` - The `zcrawkeygen` RPC method is disabled.
### Disabled in 5.0.1
The following features are disabled by default, and will be removed in release 5.3.0.
- `dumpwallet` - The `dumpwallet` RPC method is disabled.

View File

@ -14,3 +14,14 @@ Option handling
whenever the transaction does not contain Orchard components. This can be
helpful if recipients of transactions are likely to be using legacy wallets
that have not yet been upgraded to support parsing V5 transactions.
Deprecated
----------
As of this release, the following previously deprecated features are disabled
by default, but may be be reenabled using `-allowdeprecated=<feature>`.
- The `dumpwallet` RPC method is disabled. It may be reenabled with
`allowdeprecated=dumpwallet`. `dumpwallet` should not be used; it is
unsafe for backup purposes as it does not return any key information
for keys used to derive shielded addresses. Use `z_exportwallet` instead.

View File

@ -64,7 +64,12 @@ class WalletBackupTest(BitcoinTestFramework):
ed2 = "-exportdir=" + self.options.tmpdir + "/node2"
# nodes 1, 2,3 are spenders, let's give them a keypool=100
extra_args = [["-keypool=100", ed0], ["-keypool=100", ed1], ["-keypool=100", ed2], []]
extra_args = [
["-keypool=100", ed0, "-allowdeprecated=dumpwallet"],
["-keypool=100", ed1, "-allowdeprecated=dumpwallet"],
["-keypool=100", ed2, "-allowdeprecated=dumpwallet"],
[]
]
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args)
connect_nodes(self.nodes[0], 3)
connect_nodes(self.nodes[1], 3)

View File

@ -24,6 +24,7 @@ bool fEnableZCRawReceive = true;
bool fEnableZCRawJoinSplit = true;
bool fEnableZCRawKeygen = true;
bool fEnableAddrTypeField = true;
bool fEnableDumpWallet = true;
#endif
static const std::string CLIENT_VERSION_STR = FormatVersion(CLIENT_VERSION);
@ -105,6 +106,7 @@ std::optional<std::string> SetAllowedDeprecatedFeaturesFromCLIArgs() {
fEnableZCRawJoinSplit = allowdeprecated.count("zcrawjoinsplit") > 0;
fEnableZCRawKeygen = allowdeprecated.count("zcrawkeygen") > 0;
fEnableAddrTypeField = allowdeprecated.count("addrtype") > 0;
fEnableDumpWallet = allowdeprecated.count("dumpwallet") > 0;
#endif
return std::nullopt;

View File

@ -38,9 +38,10 @@ static const std::set<std::string> DEFAULT_ALLOW_DEPRECATED{{
}};
static const std::set<std::string> DEFAULT_DENY_DEPRECATED{{
#ifdef ENABLE_WALLET
"dumpwallet",
"zcrawreceive",
"zcrawjoinsplit",
"zcrawkeygen",
"zcrawkeygen"
#endif
}};
@ -57,6 +58,7 @@ extern bool fEnableZCRawReceive;
extern bool fEnableZCRawJoinSplit;
extern bool fEnableZCRawKeygen;
extern bool fEnableAddrTypeField;
extern bool fEnableDumpWallet;
#endif
/**

View File

@ -549,6 +549,13 @@ UniValue dumpwallet(const UniValue& params, bool fHelp)
if (!EnsureWalletIsAvailable(fHelp))
return NullUniValue;
if (!fEnableDumpWallet)
throw runtime_error(
"dumpwallet is DEPRECATED and will be removed in a future release\n"
"\nUse z_exportwallet instead, or restart with `-allowdeprecated=dumpwallet`\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(
"dumpwallet \"filename\"\n"