Note: calculated including unconfirmed, that's ok as long as we use it for informational purposes only
| 1891 | // Note: calculated including unconfirmed, |
| 1892 | // that's ok as long as we use it for informational purposes only |
| 1893 | double CWallet::GetAverageAnonymizedRounds() const |
| 1894 | { |
| 1895 | if (!fEnableDarksend) return 0; // if we have disabled darksend, don't bother calculating anonymized funds in the balances |
| 1896 | |
| 1897 | double fTotal = 0; |
| 1898 | double fCount = 0; |
| 1899 | |
| 1900 | { |
| 1901 | LOCK(cs_wallet); |
| 1902 | for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) |
| 1903 | { |
| 1904 | const CWalletTx* pcoin = &(*it).second; |
| 1905 | |
| 1906 | if (pcoin->IsTrusted()) |
| 1907 | { |
| 1908 | int nDepth = pcoin->GetDepthInMainChain(); |
| 1909 | |
| 1910 | for (unsigned int i = 0; i < pcoin->vout.size(); i++) { |
| 1911 | //isminetype mine = IsMine(pcoin->vout[i]); |
| 1912 | bool mine = IsMine(pcoin->vout[i]); |
| 1913 | //COutput out = COutput(pcoin, i, nDepth, (mine & ISMINE_SPENDABLE) != ISMINE_NO); |
| 1914 | COutput out = COutput(pcoin, i, nDepth, mine); |
| 1915 | CTxIn vin = CTxIn(out.tx->GetHash(), out.i); |
| 1916 | |
| 1917 | if(IsSpent(out.tx->GetHash(), i) || !IsMine(pcoin->vout[i]) || !IsDenominated(vin)) continue; |
| 1918 | // if(pcoin->IsSpent(i) || !IsMine(pcoin->vout[i]) || !IsDenominated(vin)) continue; |
| 1919 | |
| 1920 | int rounds = GetInputDarksendRounds(vin); |
| 1921 | fTotal += (float)rounds; |
| 1922 | fCount += 1; |
| 1923 | } |
| 1924 | } |
| 1925 | } |
| 1926 | } |
| 1927 | |
| 1928 | if(fCount == 0) return 0; |
| 1929 | |
| 1930 | return fTotal/fCount; |
| 1931 | } |
| 1932 | |
| 1933 | |
| 1934 | // Note: calculated including unconfirmed, |
no test coverage detected