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

Function GetAccountBalance

src/rpcwallet.cpp:896–918  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

894}
895
896CAmount GetAccountBalance(CWalletDB& walletdb, const string& strAccount, int nMinDepth, const isminefilter& filter)
897{
898 CAmount nBalance = 0;
899
900 // Tally wallet transactions
901 for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) {
902 const CWalletTx& wtx = (*it).second;
903 if (!IsFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < 0)
904 continue;
905
906 CAmount nReceived, nSent, nFee;
907 wtx.GetAccountAmounts(strAccount, nReceived, nSent, nFee, filter);
908
909 if (nReceived != 0 && wtx.GetDepthInMainChain() >= nMinDepth)
910 nBalance += nReceived;
911 nBalance -= nSent + nFee;
912 }
913
914 // Tally internal accounting entries
915 nBalance += walletdb.GetAccountCreditDebit(strAccount);
916
917 return nBalance;
918}
919
920CAmount GetAccountBalance(const string& strAccount, int nMinDepth, const isminefilter& filter)
921{

Callers 3

getbalanceFunction · 0.85
sendfromFunction · 0.85
sendmanyFunction · 0.85

Calls 7

IsFinalTxFunction · 0.85
GetBlocksToMaturityMethod · 0.80
GetAccountAmountsMethod · 0.80
GetAccountCreditDebitMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
GetDepthInMainChainMethod · 0.45

Tested by

no test coverage detected