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