| 51 | } |
| 52 | |
| 53 | int AddrInfo::GetNewBucket(const uint256& nKey, const CNetAddr& src, const std::vector<bool>& asmap) const |
| 54 | { |
| 55 | std::vector<unsigned char> vchSourceGroupKey = src.GetGroup(asmap); |
| 56 | uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetGroup(asmap) << vchSourceGroupKey).GetCheapHash(); |
| 57 | uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey << vchSourceGroupKey << (hash1 % ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP)).GetCheapHash(); |
| 58 | return hash2 % ADDRMAN_NEW_BUCKET_COUNT; |
| 59 | } |
| 60 | |
| 61 | int AddrInfo::GetBucketPosition(const uint256& nKey, bool fNew, int nBucket) const |
| 62 | { |