rpc: deprecate getaddressinfo label field

This commit is contained in:
Jon Atack 2019-11-25 01:20:59 +01:00
parent dc0cabeda4
commit d48875fa20
No known key found for this signature in database
GPG Key ID: 4F5721B3D0E3921D

View File

@ -3762,18 +3762,18 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
" getaddressinfo output fields for the embedded address, excluding metadata (timestamp, hdkeypath,\n" " getaddressinfo output fields for the embedded address, excluding metadata (timestamp, hdkeypath,\n"
" hdseedid) and relation to the wallet (ismine, iswatchonly).\n" " hdseedid) and relation to the wallet (ismine, iswatchonly).\n"
" \"iscompressed\" : true|false, (boolean, optional) If the pubkey is compressed.\n" " \"iscompressed\" : true|false, (boolean, optional) If the pubkey is compressed.\n"
" \"label\" : \"label\" (string) The label associated with the address. Defaults to \"\". Equivalent to the label name in the labels array below.\n" " \"label\" : \"label\" (string) DEPRECATED. The label associated with the address. Defaults to \"\". Replaced by the labels array below.\n"
" \"timestamp\" : timestamp, (number, optional) The creation time of the key, if available, expressed in " + UNIX_EPOCH_TIME + ".\n" " \"timestamp\" : timestamp, (number, optional) The creation time of the key, if available, expressed in " + UNIX_EPOCH_TIME + ".\n"
" \"hdkeypath\" : \"keypath\" (string, optional) The HD keypath, if the key is HD and available.\n" " \"hdkeypath\" : \"keypath\" (string, optional) The HD keypath, if the key is HD and available.\n"
" \"hdseedid\" : \"<hash160>\" (string, optional) The Hash160 of the HD seed.\n" " \"hdseedid\" : \"<hash160>\" (string, optional) The Hash160 of the HD seed.\n"
" \"hdmasterfingerprint\" : \"<hash160>\" (string, optional) The fingerprint of the master key.\n" " \"hdmasterfingerprint\" : \"<hash160>\" (string, optional) The fingerprint of the master key.\n"
" \"labels\" (json object) An array of labels associated with the address. Currently limited to one label but returned\n" " \"labels\" (array) Array of labels associated with the address. Currently limited to one label but returned\n"
" as an array to keep the API stable if multiple labels are enabled in the future.\n" " as an array to keep the API stable if multiple labels are enabled in the future.\n"
" [\n" " [\n"
" \"label name\" (string) The label name. Defaults to \"\". Equivalent to the label field above.\n\n" " \"label name\" (string) The label name. Defaults to \"\".\n"
" DEPRECATED, will be removed in 0.21. To re-enable, launch bitcoind with `-deprecatedrpc=labelspurpose`:\n" " DEPRECATED, will be removed in 0.21. To re-enable, launch bitcoind with `-deprecatedrpc=labelspurpose`:\n"
" { (json object of label data)\n" " {\n"
" \"name\" : \"label name\" (string) The label name. Defaults to \"\". Equivalent to the label field above.\n" " \"name\" : \"label name\" (string) The label name. Defaults to \"\".\n"
" \"purpose\" : \"purpose\" (string) The purpose of the associated address (send or receive).\n" " \"purpose\" : \"purpose\" (string) The purpose of the associated address (send or receive).\n"
" }\n" " }\n"
" ]\n" " ]\n"
@ -3817,10 +3817,10 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
UniValue detail = DescribeWalletAddress(pwallet, dest); UniValue detail = DescribeWalletAddress(pwallet, dest);
ret.pushKVs(detail); ret.pushKVs(detail);
// Return label field if existing. Currently only one label can be // DEPRECATED: Return label field if existing. Currently only one label can
// associated with an address, so the label should be equivalent to the // 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. // value of the name key/value pair in the labels array below.
if (pwallet->mapAddressBook.count(dest)) { if ((pwallet->chain().rpcEnableDeprecated("label")) && (pwallet->mapAddressBook.count(dest))) {
ret.pushKV("label", pwallet->mapAddressBook[dest].name); ret.pushKV("label", pwallet->mapAddressBook[dest].name);
} }