MCPcopy Create free account
hub / github.com/LUX-Core/lux / GetAccountAmounts

Method GetAccountAmounts

src/wallet.cpp:1599–1626  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1597}
1598
1599void CWalletTx::GetAccountAmounts(const string& strAccount, CAmount& nReceived, CAmount& nSent, CAmount& nFee, const isminefilter& filter) const
1600{
1601 nReceived = nSent = nFee = 0;
1602
1603 CAmount allFee;
1604 string strSentAccount;
1605 list<COutputEntry> listReceived;
1606 list<COutputEntry> listSent;
1607 GetAmounts(listReceived, listSent, allFee, strSentAccount, filter);
1608
1609 if (strAccount == strSentAccount) {
1610 for (const COutputEntry& s : listSent)
1611 nSent += s.amount;
1612 nFee = allFee;
1613 }
1614 {
1615 LOCK(pwallet->cs_wallet);
1616 for (const COutputEntry& r : listReceived) {
1617 if (pwallet->mapAddressBook.count(r.destination)) {
1618 map<CTxDestination, CAddressBookData>::const_iterator mi = pwallet->mapAddressBook.find(r.destination);
1619 if (mi != pwallet->mapAddressBook.end() && (*mi).second.name == strAccount)
1620 nReceived += r.amount;
1621 } else if (strAccount.empty()) {
1622 nReceived += r.amount;
1623 }
1624 }
1625 }
1626}
1627
1628/**
1629 * Scan the block chain (starting in pindexStart) for transactions

Callers 1

GetAccountBalanceFunction · 0.80

Calls 4

countMethod · 0.45
findMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected