@@ -3778,23 +3778,39 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
37783778
37793779 CScript scriptPubKey = GetScriptForDestination (dest);
37803780 ret.pushKV (" scriptPubKey" , HexStr (scriptPubKey.begin (), scriptPubKey.end ()));
3781+
37813782 const SigningProvider* provider = pwallet->GetSigningProvider (scriptPubKey);
37823783
37833784 isminetype mine = pwallet->IsMine (dest);
37843785 ret.pushKV (" ismine" , bool (mine & ISMINE_SPENDABLE));
3786+
37853787 bool solvable = provider && IsSolvable (*provider, scriptPubKey);
37863788 ret.pushKV (" solvable" , solvable);
3789+
37873790 if (solvable) {
37883791 ret.pushKV (" desc" , InferDescriptor (scriptPubKey, *provider)->ToString ());
37893792 }
3793+
37903794 ret.pushKV (" iswatchonly" , bool (mine & ISMINE_WATCH_ONLY));
3795+
3796+ // Return DescribeWalletAddress fields.
3797+ // Always returned: isscript, ischange, iswitness.
3798+ // Optional: witness_version, witness_program, script, hex, pubkeys (array),
3799+ // sigsrequired, pubkey, embedded, iscompressed.
37913800 UniValue detail = DescribeWalletAddress (pwallet, dest);
37923801 ret.pushKVs (detail);
3802+
3803+ // Return label field if existing. Currently only one label can be
3804+ // associated with an address, so the label should be equivalent to the
3805+ // value of the name key/value pair in the labels hash array below.
37933806 if (pwallet->mapAddressBook .count (dest)) {
37943807 ret.pushKV (" label" , pwallet->mapAddressBook [dest].name );
37953808 }
3809+
37963810 ret.pushKV (" ischange" , pwallet->IsChange (scriptPubKey));
37973811
3812+ // Fetch KeyMetadata, if present, for the timestamp, hdkeypath, hdseedid,
3813+ // and hdmasterfingerprint fields.
37983814 ScriptPubKeyMan* spk_man = pwallet->GetScriptPubKeyMan (scriptPubKey);
37993815 if (spk_man) {
38003816 if (const CKeyMetadata* meta = spk_man->GetMetadata (dest)) {
@@ -3807,9 +3823,11 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
38073823 }
38083824 }
38093825
3810- // Currently only one label can be associated with an address, return an array
3811- // so the API remains stable if we allow multiple labels to be associated with
3812- // an address.
3826+ // Return a labels array containing a hash of key/value pairs for the label
3827+ // name and address purpose. The name value is equivalent to the label field
3828+ // above. Currently only one label can be associated with an address, but we
3829+ // return an array so the API remains stable if we allow multiple labels to
3830+ // be associated with an address in the future.
38133831 UniValue labels (UniValue::VARR);
38143832 std::map<CTxDestination, CAddressBookData>::iterator mi = pwallet->mapAddressBook .find (dest);
38153833 if (mi != pwallet->mapAddressBook .end ()) {
0 commit comments