Skip to content

Commit

Permalink
Merge pull request #5975 from nuttycom/deprecation/disable_dumpwallet
Browse files Browse the repository at this point in the history
Mark the `dumpwallet` RPC method as disabled.

Admin merge requested by @str4d
  • Loading branch information
softminus committed May 27, 2022
2 parents 1b5ab4a + f3a9dcc commit aad3da4
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 2 deletions.
7 changes: 7 additions & 0 deletions doc/book/src/user/deprecation.md
Expand Up @@ -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.

11 changes: 11 additions & 0 deletions doc/release-notes.md
Expand Up @@ -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.
7 changes: 6 additions & 1 deletion qa/rpc-tests/walletbackup.py
Expand Up @@ -64,7 +64,12 @@ def setup_network(self, split=False):
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)
Expand Down
2 changes: 2 additions & 0 deletions src/deprecation.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion src/deprecation.h
Expand Up @@ -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
}};

Expand All @@ -57,6 +58,7 @@ extern bool fEnableZCRawReceive;
extern bool fEnableZCRawJoinSplit;
extern bool fEnableZCRawKeygen;
extern bool fEnableAddrTypeField;
extern bool fEnableDumpWallet;
#endif

/**
Expand Down
7 changes: 7 additions & 0 deletions src/wallet/rpcdump.cpp
Expand Up @@ -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"
Expand Down

0 comments on commit aad3da4

Please sign in to comment.