From 4ea9de5ff6195ac420a0c31c1b84dc5f2ae1a8bb Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Thu, 21 Apr 2022 16:47:56 -0600 Subject: [PATCH] Remove zcrawreceive, zcrawjoinsplit, zcrawkeygen from default-allowed deprecated methods. --- doc/release-notes.md | 7 +++++++ qa/rpc-tests/wallet_deprecation.py | 9 +++++++-- qa/rpc-tests/zcjoinsplit.py | 2 +- qa/rpc-tests/zcjoinsplitdoublespend.py | 6 +++++- src/deprecation.h | 6 +++--- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/doc/release-notes.md b/doc/release-notes.md index 7af463564..f9f0181b5 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -41,6 +41,13 @@ Option handling is returned in addition to `pool` or `address_type` (which contain the same information) in the results of RPC methods that return address metadata. +RPC Changes +----------- + +- The deprecated `zcrawkeygen`, `zcrawreceive`, and `zcrawjoinsplit` RPC + methods are now disabled by default. Start with `-allowdeprecated=all` + or select individual features if you wish to continue using these APIs. + Build system ------------ diff --git a/qa/rpc-tests/wallet_deprecation.py b/qa/rpc-tests/wallet_deprecation.py index 04a6bcf6c..bc1652a7d 100755 --- a/qa/rpc-tests/wallet_deprecation.py +++ b/qa/rpc-tests/wallet_deprecation.py @@ -31,8 +31,13 @@ class WalletDeprecationTest(BitcoinTestFramework): # z_getnewaddress is deprecated, but enabled by default so it should succeed self.nodes[0].z_getnewaddress() - # zcrawkeygen is enabled by default so should succeed. - self.nodes[0].zcrawkeygen() + # zcrawkeygen is deprecated, and not enabled by default so it should fail + errorString = '' + try: + self.nodes[0].zcrawkeygen() + except JSONRPCException as e: + errorString = e.error['message'] + assert "DEPRECATED" in errorString # restart with a specific selection of deprecated methods enabled stop_nodes(self.nodes) diff --git a/qa/rpc-tests/zcjoinsplit.py b/qa/rpc-tests/zcjoinsplit.py index 85af3c1fb..d26ce9d09 100755 --- a/qa/rpc-tests/zcjoinsplit.py +++ b/qa/rpc-tests/zcjoinsplit.py @@ -17,7 +17,7 @@ class JoinSplitTest(BitcoinTestFramework): def setup_network(self): self.nodes = [] self.is_network_split = False - self.nodes.append(start_node(0, self.options.tmpdir)) + self.nodes.append(start_node(0, self.options.tmpdir, ["-allowdeprecated=all"])) def run_test(self): zckeypair = self.nodes[0].zcrawkeygen() diff --git a/qa/rpc-tests/zcjoinsplitdoublespend.py b/qa/rpc-tests/zcjoinsplitdoublespend.py index 545a819d0..90cf46f5c 100755 --- a/qa/rpc-tests/zcjoinsplitdoublespend.py +++ b/qa/rpc-tests/zcjoinsplitdoublespend.py @@ -7,7 +7,7 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.authproxy import JSONRPCException from test_framework.util import assert_equal, connect_nodes, \ - gather_inputs, sync_blocks + gather_inputs, start_nodes, sync_blocks import time @@ -16,6 +16,10 @@ class JoinSplitTest(BitcoinTestFramework): # Start with split network: return super(JoinSplitTest, self).setup_network(True) + def setup_nodes(self): + return start_nodes(self.num_nodes, self.options.tmpdir, + extra_args = [["-allowdeprecated=all"]] * self.num_nodes) + def txid_in_mempool(self, node, txid): exception_triggered = False diff --git a/src/deprecation.h b/src/deprecation.h index 56a82ef59..e1979ac94 100644 --- a/src/deprecation.h +++ b/src/deprecation.h @@ -26,14 +26,14 @@ static const std::set DEFAULT_ALLOW_DEPRECATED{{ "legacy_privacy", "getnewaddress", "z_getnewaddress", - "zcrawreceive", - "zcrawjoinsplit", - "zcrawkeygen", "addrtype" #endif }}; static const std::set DEFAULT_DENY_DEPRECATED{{ #ifdef ENABLE_WALLET + "zcrawreceive", + "zcrawjoinsplit", + "zcrawkeygen", #endif }};