// Returns the number of entries processed
int CAddrMan::CopyDestinationStats( std::vector<CDestinationStats>& vStats )
{
    int nSize = 0;
    vStats.clear();
    vStats.reserve( mapI2pHashes.size() );
    for( std::map<uint256, int>::iterator it = mapI2pHashes.begin(); it != mapI2pHashes.end(); it++) {
        CDestinationStats stats;
        std::map<int, CAddrInfo>::iterator it2 = mapInfo.find((*it).second);
        if (it2 != mapInfo.end()) {
            CAddrInfo* paddr = &(*it2).second;
            stats.sAddress = paddr->ToString();
            stats.fInTried = paddr->fInTried;
            stats.uPort = paddr->GetPort();
            stats.nServices = paddr->nServices;
            stats.nAttempts = paddr->nAttempts;
            stats.nLastTry = paddr->nLastTry;
            stats.nSuccessTime = paddr->nLastSuccess;
            stats.sSource = paddr->source.ToString();
            stats.sBase64 = paddr->GetI2pDestination();
            nSize++;
            vStats.push_back( stats );
        }
    }
    assert( mapI2pHashes.size() == nSize );
    return nSize;
}
void CAddrMan::CheckAndDeleteB32Hash( const int nID, const CAddrInfo& aTerrible )
{
    if( aTerrible.IsI2P() ) {
        uint256 b32hash = GetI2pDestinationHash( aTerrible.GetI2pDestination() );
        if( mapI2pHashes.count( b32hash ) == 1 ) {
            int nID2 = mapI2pHashes[ b32hash ];
            if( nID == nID2 )            // Yap this is the one they want to delete, and it exists
                mapI2pHashes.erase( b32hash );
            else {
                LogPrint( "addrman", "While attempting to erase base32 hash %s, it was unexpected that the ids differ id1=%d != id2=%d\n", b32hash.GetHex(), nID, nID2 );
                // CAddrInfo& info2 = mapInfo[nID2];
                // aTerrible.print();
                // info2.print();
            }
        }
        else {
            LogPrint( "addrman", "While attempting to remove base32 hash %s, it was found to not exist.\n", b32hash.GetHex() );
            // aTerrible.print();
        }
    }
}
/** \brief Simply looks up the hash, if the id is found returns a pointer to the
            CAddrInfo(CAddress(CService(CNetAddr()))) class object where the base64 string is stored
 *
 * \param sB32addr const string&
 * \return string, null if not found or the Base64 destination string of give b32.i2p address
 *
 */
std::string CAddrMan::GetI2pBase64Destination(const std::string& sB32addr)
{
    CAddrInfo* paddr = LookupB32addr(sB32addr);
    return  paddr && paddr->IsI2P() ? paddr->GetI2pDestination() : std::string();
}