rpcwallet: add 'ischange' field to 'getaddressinfo' response

This commit is contained in:
whythat
2018-10-06 00:24:06 +03:00
parent f504a1402a
commit 93d1aa9abc
4 changed files with 13 additions and 2 deletions
+7 -2
View File
@@ -1261,6 +1261,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
@@ -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);