| 3808 | } |
| 3809 | |
| 3810 | std::map<CTxDestination, CAmount> CWallet::GetAddressBalances() |
| 3811 | { |
| 3812 | map<CTxDestination, CAmount> balances; |
| 3813 | |
| 3814 | { |
| 3815 | LOCK(cs_wallet); |
| 3816 | for (const auto& walletEntry : mapWallet) { |
| 3817 | const CWalletTx* pcoin = &walletEntry.second; |
| 3818 | |
| 3819 | if (!IsFinalTx(*pcoin) || !pcoin->IsTrusted()) |
| 3820 | continue; |
| 3821 | |
| 3822 | if (pcoin->IsCoinBase() && pcoin->GetBlocksToMaturity() > 0) |
| 3823 | continue; |
| 3824 | |
| 3825 | int nDepth = pcoin->GetDepthInMainChain(); |
| 3826 | if (nDepth < (pcoin->IsFromMe(ISMINE_ALL) ? 0 : 1)) |
| 3827 | continue; |
| 3828 | |
| 3829 | for (unsigned int i = 0; i < pcoin->vout.size(); i++) { |
| 3830 | CTxDestination addr; |
| 3831 | if (!IsMine(pcoin->vout[i])) |
| 3832 | continue; |
| 3833 | if (!ExtractDestination(pcoin->vout[i].scriptPubKey, addr)) |
| 3834 | continue; |
| 3835 | |
| 3836 | CAmount n = IsSpent(walletEntry.first, i) ? 0 : pcoin->vout[i].nValue; |
| 3837 | |
| 3838 | if (!balances.count(addr)) |
| 3839 | balances[addr] = 0; |
| 3840 | balances[addr] += n; |
| 3841 | } |
| 3842 | } |
| 3843 | } |
| 3844 | |
| 3845 | return balances; |
| 3846 | } |
| 3847 | |
| 3848 | set<set<CTxDestination> > CWallet::GetAddressGroupings() |
| 3849 | { |
no test coverage detected