|
11 | 11 |
|
12 | 12 | int CAddrInfo::GetTriedBucket(const uint256& nKey) const |
13 | 13 | { |
14 | | - uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetKey()).GetHash().GetCheapHash(); |
15 | | - uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey << GetGroup() << (hash1 % ADDRMAN_TRIED_BUCKETS_PER_GROUP)).GetHash().GetCheapHash(); |
| 14 | + uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetKey()).GetCheapHash(); |
| 15 | + uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey << GetGroup() << (hash1 % ADDRMAN_TRIED_BUCKETS_PER_GROUP)).GetCheapHash(); |
16 | 16 | return hash2 % ADDRMAN_TRIED_BUCKET_COUNT; |
17 | 17 | } |
18 | 18 |
|
19 | 19 | int CAddrInfo::GetNewBucket(const uint256& nKey, const CNetAddr& src) const |
20 | 20 | { |
21 | 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(); |
| 22 | + uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetGroup() << vchSourceGroupKey).GetCheapHash(); |
| 23 | + uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey << vchSourceGroupKey << (hash1 % ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP)).GetCheapHash(); |
24 | 24 | return hash2 % ADDRMAN_NEW_BUCKET_COUNT; |
25 | 25 | } |
26 | 26 |
|
27 | 27 | int CAddrInfo::GetBucketPosition(const uint256 &nKey, bool fNew, int nBucket) const |
28 | 28 | { |
29 | | - uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << (fNew ? 'N' : 'K') << nBucket << GetKey()).GetHash().GetCheapHash(); |
| 29 | + uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << (fNew ? 'N' : 'K') << nBucket << GetKey()).GetCheapHash(); |
30 | 30 | return hash1 % ADDRMAN_BUCKET_SIZE; |
31 | 31 | } |
32 | 32 |
|
|
0 commit comments