| 17 | } |
| 18 | |
| 19 | int CAddrInfo::GetNewBucket(const uint256& nKey, const CNetAddr& src) const |
| 20 | { |
| 21 | std::vector<unsigned char> vchSourceGroupKey = src.GetGroup(); |
| 22 | uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetGroup() << vchSourceGroupKey).GetHash().GetCheapHash(); |
| 23 | uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey << vchSourceGroupKey << (hash1 % ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP)).GetHash().GetCheapHash(); |
| 24 | return hash2 % ADDRMAN_NEW_BUCKET_COUNT; |
| 25 | } |
| 26 | |
| 27 | int CAddrInfo::GetBucketPosition(const uint256 &nKey, bool fNew, int nBucket) const |
| 28 | { |