From 3b653fca313a5b3818a6f44c9e48e3638498d291 Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Wed, 11 May 2022 11:27:31 -0600 Subject: [PATCH 1/2] Note that `gettransaction` doesn't provide shielded info in RPC help. Fixes #5682 --- src/wallet/rpcwallet.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index b64808f98..dc17cd60f 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1701,7 +1701,9 @@ UniValue gettransaction(const UniValue& params, bool fHelp) if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "gettransaction \"txid\" ( includeWatchonly )\n" - "\nReturns detailed information about in-wallet transaction .\n" + "\nReturns detailed information about in-wallet transaction . This does not\n" + "include complete information about shielded components of the transaction; to obtain\n" + "details about shielded components of the transaction use `z_viewtransaction`.\n" "\nArguments:\n" "1. \"txid\" (string, required) The transaction id\n" "2. \"includeWatchonly\" (bool, optional, default=false) Whether to include watchonly addresses in balance calculation and details[]\n" From 59cabff22d25986adcd0dd51cd482d5fdc629a5b Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Wed, 11 May 2022 11:27:31 -0600 Subject: [PATCH 2/2] Deprecate the `vjoinsplit` field of `gettransaction` results. Author: Kris Nuttycombe Signed-off-by: Daira Hopwood --- doc/book/src/user/deprecation.md | 5 +++++ doc/release-notes.md | 9 +++++++++ src/deprecation.cpp | 2 ++ src/deprecation.h | 4 +++- src/wallet/rpcwallet.cpp | 6 ++++-- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/doc/book/src/user/deprecation.md b/doc/book/src/user/deprecation.md index b6427da87..3098e6842 100644 --- a/doc/book/src/user/deprecation.md +++ b/doc/book/src/user/deprecation.md @@ -55,6 +55,11 @@ default as of release 5.3.0. using this metadata be updated to use the `pool` or `address_type` attributes, which have replaced the `type` attribute, as appropriate. +### Deprecated in 5.1.0 + + - `wallettxvjoinsplit` - The `vjoinsplit` attribute returned by the + `gettransaction` RPC method is deprecated. + Stage 2 ------- diff --git a/doc/release-notes.md b/doc/release-notes.md index 313ab5e8c..fd5ff77c9 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -25,3 +25,12 @@ by default, but may be be reenabled using `-allowdeprecated=`. `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. + +As of this release, the following features are deprecated, but remain available +by default. These features may be disabled by setting `-allowdeprecated=none`. +After at least 3 minor-version releases, these features will be disabled by +default and the following flags to `-allowdeprecated` will be required to +permit their continued use: + + - `wallettxvjoinsplit` - controls availability of the deprecated `vjoinsplit` + attribute returned by the `gettransaction` RPC method. diff --git a/src/deprecation.cpp b/src/deprecation.cpp index ad91f19dc..46f350c92 100644 --- a/src/deprecation.cpp +++ b/src/deprecation.cpp @@ -25,6 +25,7 @@ bool fEnableZCRawJoinSplit = true; bool fEnableZCRawKeygen = true; bool fEnableAddrTypeField = true; bool fEnableDumpWallet = true; +bool fEnableWalletTxVJoinSplit = true; #endif static const std::string CLIENT_VERSION_STR = FormatVersion(CLIENT_VERSION); @@ -107,6 +108,7 @@ std::optional SetAllowedDeprecatedFeaturesFromCLIArgs() { fEnableZCRawKeygen = allowdeprecated.count("zcrawkeygen") > 0; fEnableAddrTypeField = allowdeprecated.count("addrtype") > 0; fEnableDumpWallet = allowdeprecated.count("dumpwallet") > 0; + fEnableWalletTxVJoinSplit = allowdeprecated.count("wallettxvjoinsplit") > 0; #endif return std::nullopt; diff --git a/src/deprecation.h b/src/deprecation.h index cd84c850a..afbd286f9 100644 --- a/src/deprecation.h +++ b/src/deprecation.h @@ -33,7 +33,8 @@ static const std::set DEFAULT_ALLOW_DEPRECATED{{ "z_getbalance", "z_gettotalbalance", "z_listaddresses", - "addrtype" + "addrtype", + "wallettxvjoinsplit" #endif }}; static const std::set DEFAULT_DENY_DEPRECATED{{ @@ -59,6 +60,7 @@ extern bool fEnableZCRawJoinSplit; extern bool fEnableZCRawKeygen; extern bool fEnableAddrTypeField; extern bool fEnableDumpWallet; +extern bool fEnableWalletTxVJoinSplit; #endif /** diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index dc17cd60f..8ae1c410a 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -151,7 +151,9 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry) for (const std::pair& item : wtx.mapValue) entry.pushKV(item.first, item.second); - entry.pushKV("vjoinsplit", TxJoinSplitToJSON(wtx)); + if (fEnableWalletTxVJoinSplit) { + entry.pushKV("vjoinsplit", TxJoinSplitToJSON(wtx)); + } } UniValue getnewaddress(const UniValue& params, bool fHelp) @@ -1729,7 +1731,7 @@ UniValue gettransaction(const UniValue& params, bool fHelp) " }\n" " ,...\n" " ],\n" - " \"vjoinsplit\" : [\n" + " \"vjoinsplit\" : (DEPRECATED) [\n" " {\n" " \"anchor\" : \"treestateref\", (string) Merkle root of note commitment tree\n" " \"nullifiers\" : [ string, ... ] (string) Nullifiers of input notes\n"