diff options
| author | whythat <[email protected]> | 2018-10-06 00:24:06 +0300 |
|---|---|---|
| committer | whythat <[email protected]> | 2018-10-13 19:30:13 +0300 |
| commit | 93d1aa9abc4402715f781db2bc26bdde4447e951 (patch) | |
| tree | 30a929c15431a127d60b0603b9b4909849db70b3 /src/wallet/wallet.cpp | |
| parent | Merge #14395: Fix typos and cleanup (diff) | |
| download | discoin-93d1aa9abc4402715f781db2bc26bdde4447e951.tar.xz discoin-93d1aa9abc4402715f781db2bc26bdde4447e951.zip | |
rpcwallet: add 'ischange' field to 'getaddressinfo' response
Diffstat (limited to 'src/wallet/wallet.cpp')
| -rw-r--r-- | src/wallet/wallet.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index afe47d986..f37aa3211 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1262,6 +1262,11 @@ CAmount CWallet::GetCredit(const CTxOut& txout, const isminefilter& filter) cons bool CWallet::IsChange(const CTxOut& txout) const { + return IsChange(txout.scriptPubKey); +} + +bool CWallet::IsChange(const CScript& script) const +{ // TODO: fix handling of 'change' outputs. The assumption is that any // payment to a script that is ours, but is not in the address book // is change. That assumption is likely to break when we implement multisignature @@ -1269,10 +1274,10 @@ bool CWallet::IsChange(const CTxOut& txout) const // a better way of identifying which outputs are 'the send' and which are // 'the change' will need to be implemented (maybe extend CWalletTx to remember // which output, if any, was change). - if (::IsMine(*this, txout.scriptPubKey)) + if (::IsMine(*this, script)) { CTxDestination address; - if (!ExtractDestination(txout.scriptPubKey, address)) + if (!ExtractDestination(script, address)) return true; LOCK(cs_wallet); |