Skip to content

Commit d48875f

Browse files
committed
rpc: deprecate getaddressinfo label field
1 parent dc0cabe commit d48875f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/wallet/rpcwallet.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -3762,18 +3762,18 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
37623762
" getaddressinfo output fields for the embedded address, excluding metadata (timestamp, hdkeypath,\n"
37633763
" hdseedid) and relation to the wallet (ismine, iswatchonly).\n"
37643764
" \"iscompressed\" : true|false, (boolean, optional) If the pubkey is compressed.\n"
3765-
" \"label\" : \"label\" (string) The label associated with the address. Defaults to \"\". Equivalent to the label name in the labels array below.\n"
3765+
" \"label\" : \"label\" (string) DEPRECATED. The label associated with the address. Defaults to \"\". Replaced by the labels array below.\n"
37663766
" \"timestamp\" : timestamp, (number, optional) The creation time of the key, if available, expressed in " + UNIX_EPOCH_TIME + ".\n"
37673767
" \"hdkeypath\" : \"keypath\" (string, optional) The HD keypath, if the key is HD and available.\n"
37683768
" \"hdseedid\" : \"<hash160>\" (string, optional) The Hash160 of the HD seed.\n"
37693769
" \"hdmasterfingerprint\" : \"<hash160>\" (string, optional) The fingerprint of the master key.\n"
3770-
" \"labels\" (json object) An array of labels associated with the address. Currently limited to one label but returned\n"
3771-
" as an array to keep the API stable if multiple labels are enabled in the future.\n"
3770+
" \"labels\" (array) Array of labels associated with the address. Currently limited to one label but returned\n"
3771+
" as an array to keep the API stable if multiple labels are enabled in the future.\n"
37723772
" [\n"
3773-
" \"label name\" (string) The label name. Defaults to \"\". Equivalent to the label field above.\n\n"
3773+
" \"label name\" (string) The label name. Defaults to \"\".\n"
37743774
" DEPRECATED, will be removed in 0.21. To re-enable, launch bitcoind with `-deprecatedrpc=labelspurpose`:\n"
3775-
" { (json object of label data)\n"
3776-
" \"name\" : \"label name\" (string) The label name. Defaults to \"\". Equivalent to the label field above.\n"
3775+
" {\n"
3776+
" \"name\" : \"label name\" (string) The label name. Defaults to \"\".\n"
37773777
" \"purpose\" : \"purpose\" (string) The purpose of the associated address (send or receive).\n"
37783778
" }\n"
37793779
" ]\n"
@@ -3817,10 +3817,10 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
38173817
UniValue detail = DescribeWalletAddress(pwallet, dest);
38183818
ret.pushKVs(detail);
38193819

3820-
// Return label field if existing. Currently only one label can be
3821-
// associated with an address, so the label should be equivalent to the
3820+
// DEPRECATED: Return label field if existing. Currently only one label can
3821+
// be associated with an address, so the label should be equivalent to the
38223822
// value of the name key/value pair in the labels array below.
3823-
if (pwallet->mapAddressBook.count(dest)) {
3823+
if ((pwallet->chain().rpcEnableDeprecated("label")) && (pwallet->mapAddressBook.count(dest))) {
38243824
ret.pushKV("label", pwallet->mapAddressBook[dest].name);
38253825
}
38263826

0 commit comments

Comments
 (0)