Skip to content

Commit 72af93f

Browse files
committed
test: getaddressinfo label deprecation test
1 parent d48875f commit 72af93f

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2020 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5+
"""
6+
Test deprecation of the RPC getaddressinfo `label` field. It has been
7+
superceded by the `labels` field.
8+
9+
"""
10+
from test_framework.test_framework import BitcoinTestFramework
11+
12+
class GetAddressInfoLabelDeprecationTest(BitcoinTestFramework):
13+
def set_test_params(self):
14+
self.num_nodes = 2
15+
self.setup_clean_chain = False
16+
# Start node[0] with -deprecatedrpc=label, and node[1] without.
17+
self.extra_args = [["-deprecatedrpc=label"], []]
18+
19+
def skip_test_if_missing_module(self):
20+
self.skip_if_no_wallet()
21+
22+
def test_label_with_deprecatedrpc_flag(self):
23+
self.log.info("Test getaddressinfo label with -deprecatedrpc flag")
24+
node = self.nodes[0]
25+
address = node.getnewaddress()
26+
info = node.getaddressinfo(address)
27+
assert "label" in info
28+
29+
def test_label_without_deprecatedrpc_flag(self):
30+
self.log.info("Test getaddressinfo label without -deprecatedrpc flag")
31+
node = self.nodes[1]
32+
address = node.getnewaddress()
33+
info = node.getaddressinfo(address)
34+
assert "label" not in info
35+
36+
def run_test(self):
37+
"""Test getaddressinfo label with and without -deprecatedrpc flag."""
38+
self.test_label_with_deprecatedrpc_flag()
39+
self.test_label_without_deprecatedrpc_flag()
40+
41+
42+
if __name__ == '__main__':
43+
GetAddressInfoLabelDeprecationTest().main()

test/functional/test_runner.py

+1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@
213213
'feature_blocksdir.py',
214214
'feature_config_args.py',
215215
'rpc_getaddressinfo_labels_purpose_deprecation.py',
216+
'rpc_getaddressinfo_label_deprecation.py',
216217
'rpc_help.py',
217218
'feature_help.py',
218219
'feature_shutdown.py',

0 commit comments

Comments
 (0)