MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ScriptIsChange

Function ScriptIsChange

src/wallet/receive.cpp:52–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52bool ScriptIsChange(const CWallet& wallet, const CScript& script)
53{
54 // TODO: fix handling of 'change' outputs. The assumption is that any
55 // payment to a script that is ours, but is not in the address book
56 // is change. That assumption is likely to break when we implement multisignature
57 // wallets that return change back into a multi-signature-protected address;
58 // a better way of identifying which outputs are 'the send' and which are
59 // 'the change' will need to be implemented (maybe extend CWalletTx to remember
60 // which output, if any, was change).
61 AssertLockHeld(wallet.cs_wallet);
62 if (wallet.IsMine(script))
63 {
64 CTxDestination address;
65 if (!ExtractDestination(script, address))
66 return true;
67 if (!wallet.FindAddressBookEntry(address)) {
68 return true;
69 }
70 }
71 return false;
72}
73
74bool OutputIsChange(const CWallet& wallet, const CTxOut& txout)
75{

Callers 2

OutputIsChangeFunction · 0.85
getaddressinfoFunction · 0.85

Calls 3

ExtractDestinationFunction · 0.85
FindAddressBookEntryMethod · 0.80
IsMineMethod · 0.45

Tested by

no test coverage detected