@@ -3778,23 +3778,39 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
3778
3778
3779
3779
CScript scriptPubKey = GetScriptForDestination (dest);
3780
3780
ret.pushKV (" scriptPubKey" , HexStr (scriptPubKey.begin (), scriptPubKey.end ()));
3781
+
3781
3782
const SigningProvider* provider = pwallet->GetSigningProvider (scriptPubKey);
3782
3783
3783
3784
isminetype mine = pwallet->IsMine (dest);
3784
3785
ret.pushKV (" ismine" , bool (mine & ISMINE_SPENDABLE));
3786
+
3785
3787
bool solvable = provider && IsSolvable (*provider, scriptPubKey);
3786
3788
ret.pushKV (" solvable" , solvable);
3789
+
3787
3790
if (solvable) {
3788
3791
ret.pushKV (" desc" , InferDescriptor (scriptPubKey, *provider)->ToString ());
3789
3792
}
3793
+
3790
3794
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.
3791
3800
UniValue detail = DescribeWalletAddress (pwallet, dest);
3792
3801
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.
3793
3806
if (pwallet->mapAddressBook .count (dest)) {
3794
3807
ret.pushKV (" label" , pwallet->mapAddressBook [dest].name );
3795
3808
}
3809
+
3796
3810
ret.pushKV (" ischange" , pwallet->IsChange (scriptPubKey));
3797
3811
3812
+ // Fetch KeyMetadata, if present, for the timestamp, hdkeypath, hdseedid,
3813
+ // and hdmasterfingerprint fields.
3798
3814
ScriptPubKeyMan* spk_man = pwallet->GetScriptPubKeyMan (scriptPubKey);
3799
3815
if (spk_man) {
3800
3816
if (const CKeyMetadata* meta = spk_man->GetMetadata (dest)) {
@@ -3807,9 +3823,11 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
3807
3823
}
3808
3824
}
3809
3825
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.
3813
3831
UniValue labels (UniValue::VARR);
3814
3832
std::map<CTxDestination, CAddressBookData>::iterator mi = pwallet->mapAddressBook .find (dest);
3815
3833
if (mi != pwallet->mapAddressBook .end ()) {
0 commit comments