| 894 | } |
| 895 | |
| 896 | CAmount 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 | |
| 920 | CAmount GetAccountBalance(const string& strAccount, int nMinDepth, const isminefilter& filter) |
| 921 | { |
no test coverage detected