mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-31 18:22:04 +02:00
rpc: remove deprecated getaddressinfo label
field
This commit is contained in:
parent
b1b1739944
commit
645a8653c8
@ -3746,7 +3746,6 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
|
|||||||
"hdseedid) and relation to the wallet (ismine, iswatchonly)."},
|
"hdseedid) and relation to the wallet (ismine, iswatchonly)."},
|
||||||
}},
|
}},
|
||||||
{RPCResult::Type::BOOL, "iscompressed", /* optional */ true, "If the pubkey is compressed."},
|
{RPCResult::Type::BOOL, "iscompressed", /* optional */ true, "If the pubkey is compressed."},
|
||||||
{RPCResult::Type::STR, "label", "DEPRECATED. The label associated with the address. Defaults to \"\". Replaced by the labels array below."},
|
|
||||||
{RPCResult::Type::NUM_TIME, "timestamp", /* optional */ true, "The creation time of the key, if available, expressed in " + UNIX_EPOCH_TIME + "."},
|
{RPCResult::Type::NUM_TIME, "timestamp", /* optional */ true, "The creation time of the key, if available, expressed in " + UNIX_EPOCH_TIME + "."},
|
||||||
{RPCResult::Type::STR, "hdkeypath", /* optional */ true, "The HD keypath, if the key is HD and available."},
|
{RPCResult::Type::STR, "hdkeypath", /* optional */ true, "The HD keypath, if the key is HD and available."},
|
||||||
{RPCResult::Type::STR_HEX, "hdseedid", /* optional */ true, "The Hash160 of the HD seed."},
|
{RPCResult::Type::STR_HEX, "hdseedid", /* optional */ true, "The Hash160 of the HD seed."},
|
||||||
@ -3801,14 +3800,6 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
|
|||||||
UniValue detail = DescribeWalletAddress(pwallet, dest);
|
UniValue detail = DescribeWalletAddress(pwallet, dest);
|
||||||
ret.pushKVs(detail);
|
ret.pushKVs(detail);
|
||||||
|
|
||||||
// DEPRECATED: Return label field if existing. Currently only one label can
|
|
||||||
// be associated with an address, so the label should be equivalent to the
|
|
||||||
// value of the name key/value pair in the labels array below.
|
|
||||||
const auto* address_book_entry = pwallet->FindAddressBookEntry(dest);
|
|
||||||
if (pwallet->chain().rpcEnableDeprecated("label") && address_book_entry) {
|
|
||||||
ret.pushKV("label", address_book_entry->GetLabel());
|
|
||||||
}
|
|
||||||
|
|
||||||
ret.pushKV("ischange", pwallet->IsChange(scriptPubKey));
|
ret.pushKV("ischange", pwallet->IsChange(scriptPubKey));
|
||||||
|
|
||||||
ScriptPubKeyMan* spk_man = pwallet->GetScriptPubKeyMan(scriptPubKey);
|
ScriptPubKeyMan* spk_man = pwallet->GetScriptPubKeyMan(scriptPubKey);
|
||||||
@ -3829,6 +3820,7 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
|
|||||||
// stable if we allow multiple labels to be associated with an address in
|
// stable if we allow multiple labels to be associated with an address in
|
||||||
// the future.
|
// the future.
|
||||||
UniValue labels(UniValue::VARR);
|
UniValue labels(UniValue::VARR);
|
||||||
|
const auto* address_book_entry = pwallet->FindAddressBookEntry(dest);
|
||||||
if (address_book_entry) {
|
if (address_book_entry) {
|
||||||
// DEPRECATED: The previous behavior of returning an array containing a
|
// DEPRECATED: The previous behavior of returning an array containing a
|
||||||
// JSON object of `name` and `purpose` key/value pairs is deprecated.
|
// JSON object of `name` and `purpose` key/value pairs is deprecated.
|
||||||
|
@ -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()
|
|
@ -241,7 +241,6 @@ BASE_SCRIPTS = [
|
|||||||
'feature_blocksdir.py',
|
'feature_blocksdir.py',
|
||||||
'feature_config_args.py',
|
'feature_config_args.py',
|
||||||
'rpc_getaddressinfo_labels_purpose_deprecation.py',
|
'rpc_getaddressinfo_labels_purpose_deprecation.py',
|
||||||
'rpc_getaddressinfo_label_deprecation.py',
|
|
||||||
'rpc_getdescriptorinfo.py',
|
'rpc_getdescriptorinfo.py',
|
||||||
'rpc_help.py',
|
'rpc_help.py',
|
||||||
'feature_help.py',
|
'feature_help.py',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user