| 34 | } |
| 35 | |
| 36 | int AddrInfo::GetNewBucket(const uint256& nKey, const CNetAddr& src, const NetGroupManager& netgroupman) const |
| 37 | { |
| 38 | std::vector<unsigned char> vchSourceGroupKey = netgroupman.GetGroup(src); |
| 39 | uint64_t hash1 = (HashWriter{} << nKey << netgroupman.GetGroup(*this) << vchSourceGroupKey).GetCheapHash(); |
| 40 | uint64_t hash2 = (HashWriter{} << nKey << vchSourceGroupKey << (hash1 % ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP)).GetCheapHash(); |
| 41 | return hash2 % ADDRMAN_NEW_BUCKET_COUNT; |
| 42 | } |
| 43 | |
| 44 | int AddrInfo::GetBucketPosition(const uint256& nKey, bool fNew, int bucket) const |
| 45 | { |