MCPcopy Create free account
hub / github.com/ElementsProject/elements / ScriptIsChange

Function ScriptIsChange

src/wallet/receive.cpp:116–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116bool ScriptIsChange(const CWallet& wallet, const CScript& script)
117{
118 // TODO: fix handling of 'change' outputs. The assumption is that any
119 // payment to a script that is ours, but is not in the address book
120 // is change. That assumption is likely to break when we implement multisignature
121 // wallets that return change back into a multi-signature-protected address;
122 // a better way of identifying which outputs are 'the send' and which are
123 // 'the change' will need to be implemented (maybe extend CWalletTx to remember
124 // which output, if any, was change).
125 AssertLockHeld(wallet.cs_wallet);
126 if (wallet.IsMine(script))
127 {
128 CTxDestination address;
129 if (!ExtractDestination(script, address))
130 return true;
131 if (!wallet.FindAddressBookEntry(address)) {
132 return true;
133 }
134 }
135 return false;
136}
137
138CAmountMap TxGetChange(const CWallet& wallet, const CWalletTx& wtx)
139{

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