Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 1,481 Lines • ▼ Show 20 Lines | if (!MoneyRange(txout.nValue)) { | ||||
throw std::runtime_error(std::string(__func__) + | throw std::runtime_error(std::string(__func__) + | ||||
": value out of range"); | ": value out of range"); | ||||
} | } | ||||
return (IsMine(txout) & filter) ? txout.nValue : Amount::zero(); | return (IsMine(txout) & filter) ? txout.nValue : Amount::zero(); | ||||
} | } | ||||
bool CWallet::IsChange(const CTxOut &txout) const { | 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 | // 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 | // 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 | // change. That assumption is likely to break when we implement | ||||
// multisignature wallets that return change back into a | // multisignature wallets that return change back into a | ||||
// multi-signature-protected address; a better way of identifying which | // multi-signature-protected address; a better way of identifying which | ||||
// outputs are 'the send' and which are 'the change' will need to be | // outputs are 'the send' and which are 'the change' will need to be | ||||
// implemented (maybe extend CWalletTx to remember which output, if any, was | // implemented (maybe extend CWalletTx to remember which output, if any, was | ||||
// change). | // change). | ||||
if (::IsMine(*this, txout.scriptPubKey)) { | if (::IsMine(*this, script)) { | ||||
CTxDestination address; | CTxDestination address; | ||||
if (!ExtractDestination(txout.scriptPubKey, address)) { | if (!ExtractDestination(script, address)) { | ||||
return true; | return true; | ||||
} | } | ||||
LOCK(cs_wallet); | LOCK(cs_wallet); | ||||
if (!mapAddressBook.count(address)) { | if (!mapAddressBook.count(address)) { | ||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 3,550 Lines • Show Last 20 Lines |