mirror of https://github.com/bitcoin/bitcoin
Merge 9d2cc3f8ab
into a46065e36c
This commit is contained in:
commit
933a7dc62c
|
@ -57,6 +57,11 @@ int AddrInfo::GetTriedBucket(const uint256& nKey, const NetGroupManager& netgrou
|
|||
int AddrInfo::GetNewBucket(const uint256& nKey, const CNetAddr& src, const NetGroupManager& netgroupman) const
|
||||
{
|
||||
std::vector<unsigned char> vchSourceGroupKey = netgroupman.GetGroup(src);
|
||||
if (src.IsTor() || src.IsI2P() || src.IsCJDNS()) {
|
||||
// For the purposes of new-bucketing, treat the entire Tor network as a single source (same
|
||||
// for I2P and CJDNS).
|
||||
vchSourceGroupKey.resize(1);
|
||||
}
|
||||
uint64_t hash1 = (HashWriter{} << nKey << netgroupman.GetGroup(*this) << vchSourceGroupKey).GetCheapHash();
|
||||
uint64_t hash2 = (HashWriter{} << nKey << vchSourceGroupKey << (hash1 % ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP)).GetCheapHash();
|
||||
return hash2 % ADDRMAN_NEW_BUCKET_COUNT;
|
||||
|
|
Loading…
Reference in New Issue