d3bc184081
doc: update release notes with getaddressinfo label deprecation (Jon Atack)72af93f364
test: getaddressinfo label deprecation test (Jon Atack)d48875fa20
rpc: deprecate getaddressinfo label field (Jon Atack)dc0cabeda4
test: remove getaddressinfo label tests (Jon Atack)c7654af6f8
doc: address pr17578 review feedback (Jon Atack) Pull request description: This PR builds on #17578 (now merged) and deprecates the rpc getaddressinfo `label` field. The deprecated behavior can be re-enabled by starting bitcoind with `-deprecatedrpc=label`. See http://www.erisian.com.au/bitcoin-core-dev/log-2019-11-22.html#l-622 and https://github.com/bitcoin/bitcoin/pull/17283#issuecomment-554458001 for more context. Reviewers: This PR may be tested manually by building, then running bitcoind with and without the `-deprecatedrpc=label` flag while verifying the rpc getaddressinfo output and help text. Next step: add support for multiple labels. ACKs for top commit: jnewbery: ACKd3bc184081
laanwj: ACKd3bc184081
meshcollider: utACKd3bc184081
Tree-SHA512: f954402884ec54977def332c8160fd892f289b0d2aee1e91fed9ac3220f7e5b1f7fc6421b84cc7a5c824a0582eca4e6fc194e4e33ddd378c733c8941ac45f56d
48 lines
2 KiB
Python
Executable file
48 lines
2 KiB
Python
Executable file
#!/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 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()
|