diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-11-04 17:22:35 -0500 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-11-04 17:23:11 -0500 |
commit | b74078868b5e7a594aaf2cec08772e0b6324bc38 (patch) | |
tree | 648be634a48310a6d6795c5b98f0c4d4e3a0efe2 /src/wallet/rpcwallet.cpp | |
parent | 742ee213499194f97e59dae4971f1474ae7d57ad (diff) | |
parent | 14a06525b2ed41d9a549e744019c06afeef9b0c5 (diff) |
Merge #14410: rpcwallet: 'ischange' field for 'getaddressinfo' RPC
14a06525b2 tests: add test for 'getaddressinfo' RPC result 'ischange' field (whythat)
93d1aa9abc rpcwallet: add 'ischange' field to 'getaddressinfo' response (whythat)
Pull request description:
Implementation of proposal in #14396.
This introduces `CWallet::IsChange(CScript&)` method and replaces original `CWallet::IsChange(CTxOut&)` method with overloaded version that delegates to the new method with *txout*'s `scriptPubKey`. In this way `TODO` note from the original method can still be addressed in a single place.
Tree-SHA512: ef5dbc82d76b4b9b2fa6a70abc3385a677c55021f79e187ee2f392ee32bc6b406191f4129acae5c17b0206e72b6712e7e0cad574a4bbd966871c2e656c45e041
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r-- | src/wallet/rpcwallet.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 2aeb5c2984..d9a6b69654 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3458,6 +3458,7 @@ UniValue getaddressinfo(const JSONRPCRequest& request) " \"solvable\" : true|false, (boolean) If the address is solvable by the wallet\n" " \"iswatchonly\" : true|false, (boolean) If the address is watchonly\n" " \"isscript\" : true|false, (boolean) If the key is a script\n" + " \"ischange\" : true|false, (boolean) If the address was used for change output\n" " \"iswitness\" : true|false, (boolean) If the address is a witness address\n" " \"witness_version\" : version (numeric, optional) The version number of the witness program\n" " \"witness_program\" : \"hex\" (string, optional) The hex value of the witness program\n" @@ -3516,6 +3517,7 @@ UniValue getaddressinfo(const JSONRPCRequest& request) if (pwallet->mapAddressBook.count(dest)) { ret.pushKV("label", pwallet->mapAddressBook[dest].name); } + ret.pushKV("ischange", pwallet->IsChange(scriptPubKey)); const CKeyMetadata* meta = nullptr; CKeyID key_id = GetKeyForDestination(*pwallet, dest); if (!key_id.IsNull()) { |