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

Method GetDebit

src/wallet/wallet.cpp:1372–1389  ·  view source on GitHub ↗

Note that this function doesn't distinguish between a 0-valued input, and a not-"is mine" (according to the filter) input.

Source from the content-addressed store, hash-verified

1370// Note that this function doesn't distinguish between a 0-valued input,
1371// and a not-"is mine" (according to the filter) input.
1372CAmountMap CWallet::GetDebit(const CTxIn &txin, const isminefilter& filter) const
1373{
1374 {
1375 LOCK(cs_wallet);
1376 std::map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(txin.prevout.hash);
1377 if (mi != mapWallet.end())
1378 {
1379 const CWalletTx& prev = (*mi).second;
1380 if (txin.prevout.n < prev.tx->vout.size())
1381 if (IsMine(prev.tx->vout[txin.prevout.n]) & filter) {
1382 CAmountMap amounts;
1383 amounts[prev.GetOutputAsset(*this, txin.prevout.n)] = std::max<CAmount>(0, prev.GetOutputValueOut(*this, txin.prevout.n));
1384 return amounts;
1385 }
1386 }
1387 }
1388 return CAmountMap();
1389}
1390
1391isminetype CWallet::IsMine(const CTxOut& txout) const
1392{

Callers 2

GetCachableAmountFunction · 0.80
getDebitMethod · 0.80

Calls 7

findMethod · 0.80
GetOutputAssetMethod · 0.80
GetOutputValueOutMethod · 0.80
MoneyRangeFunction · 0.50
ParamsClass · 0.50
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected