Merge #19200: rpc: remove deprecated getaddressinfo fields
pull/764/headbc01f7ae05
doc: release note for rpc getaddressinfo removals (Jon Atack)90e989390e
rpc: getaddressinfo RPCResult fixup (Jon Atack)a8507c99da
rpc: remove deprecated getaddressinfo `labels: purpose` (Jon Atack)645a8653c8
rpc: remove deprecated getaddressinfo `label` field (Jon Atack) Pull request description: These were deprecated in #17578 and #17585, with expected 0.21 removal notified in the 0.20 release notes. ``` - The `getaddressinfo` RPC has had its `label` field deprecated (re-enable for this release using the configuration parameter `-deprecatedrpc=label`). The `labels` field is altered from returning JSON objects to returning a JSON array of label names (re-enable previous behavior for this release using the configuration parameter `-deprecatedrpc=labelspurpose`). Backwards compatibility using the deprecated configuration parameters is expected to be dropped in the 0.21 release. (#17585, #17578) ``` ACKs for top commit: Sjors: utACKbc01f7a
adamjonas: utACKbc01f7a
meshcollider: utACKbc01f7ae05
Tree-SHA512: ae1af381e32c4c3bde8b061a56382838513a9a82c88767843cdeae3a2ab8aa7d8c2e66e106d2b31ea07d74bb80c191a2f842c9aaecc7c5438ad9a9bc66d1b251
commit
02b26ba1c1
@ -0,0 +1,7 @@
|
||||
## Wallet
|
||||
|
||||
- Backwards compatibility has been dropped for two `getaddressinfo` RPC
|
||||
deprecations, as notified in the 0.20 release notes. The deprecated `label`
|
||||
field has been removed as well as the deprecated `labels` behavior of
|
||||
returning a JSON object containing `name` and `purpose` key-value pairs. Since
|
||||
0.20, the `labels` field returns a JSON array of label names. (#19200)
|
@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2020-2019 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
"""
|
||||
Test deprecation of the RPC getaddressinfo `label` field. It has been
|
||||
superseded by the `labels` field.
|
||||
|
||||
"""
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
|
||||
class GetAddressInfoLabelDeprecationTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 2
|
||||
self.setup_clean_chain = False
|
||||
# Start node[0] with -deprecatedrpc=label, and node[1] without.
|
||||
self.extra_args = [["-deprecatedrpc=label"], []]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def test_label_with_deprecatedrpc_flag(self):
|
||||
self.log.info("Test getaddressinfo label with -deprecatedrpc flag")
|
||||
node = self.nodes[0]
|
||||
address = node.getnewaddress()
|
||||
info = node.getaddressinfo(address)
|
||||
assert "label" in info
|
||||
|
||||
def test_label_without_deprecatedrpc_flag(self):
|
||||
self.log.info("Test getaddressinfo label without -deprecatedrpc flag")
|
||||
node = self.nodes[1]
|
||||
address = node.getnewaddress()
|
||||
info = node.getaddressinfo(address)
|
||||
assert "label" not in info
|
||||
|
||||
def run_test(self):
|
||||
"""Test getaddressinfo label with and without -deprecatedrpc flag."""
|
||||
self.test_label_with_deprecatedrpc_flag()
|
||||
self.test_label_without_deprecatedrpc_flag()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
GetAddressInfoLabelDeprecationTest().main()
|
@ -1,48 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2020 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
"""
|
||||
Test deprecation of RPC getaddressinfo `labels` returning an array
|
||||
containing a JSON object of `name` and purpose` key-value pairs. It now
|
||||
returns an array containing only the label name.
|
||||
|
||||
"""
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal
|
||||
|
||||
LABELS_TO_TEST = frozenset({"" , "New 𝅘𝅥𝅯 $<#>&!рыба Label"})
|
||||
|
||||
class GetAddressInfoLabelsPurposeDeprecationTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 2
|
||||
self.setup_clean_chain = False
|
||||
# Start node[0] with -deprecatedrpc=labelspurpose and node[1] without.
|
||||
self.extra_args = [["-deprecatedrpc=labelspurpose"], []]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def test_labels(self, node_num, label_name, expected_value):
|
||||
node = self.nodes[node_num]
|
||||
address = node.getnewaddress()
|
||||
if label_name != "":
|
||||
node.setlabel(address, label_name)
|
||||
self.log.info(" set label to {}".format(label_name))
|
||||
labels = node.getaddressinfo(address)["labels"]
|
||||
self.log.info(" labels = {}".format(labels))
|
||||
assert_equal(labels, expected_value)
|
||||
|
||||
def run_test(self):
|
||||
"""Test getaddressinfo labels with and without -deprecatedrpc flag."""
|
||||
self.log.info("Test getaddressinfo labels with -deprecatedrpc flag")
|
||||
for label in LABELS_TO_TEST:
|
||||
self.test_labels(node_num=0, label_name=label, expected_value=[{"name": label, "purpose": "receive"}])
|
||||
|
||||
self.log.info("Test getaddressinfo labels without -deprecatedrpc flag")
|
||||
for label in LABELS_TO_TEST:
|
||||
self.test_labels(node_num=1, label_name=label, expected_value=[label])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
GetAddressInfoLabelsPurposeDeprecationTest().main()
|
Loading…
Reference in new issue