MCPcopy Create free account
hub / github.com/LUX-Core/lux / GetNewBucket

Method GetNewBucket

src/addrman.cpp:22–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22int 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
30int CAddrInfo::GetBucketPosition(const uint256& nKey, bool fNew, int nBucket) const
31{

Callers 2

MakeTriedMethod · 0.45
Add_Method · 0.45

Calls 4

CHashWriterClass · 0.85
GetGroupMethod · 0.80
GetLow64Method · 0.45
GetHashMethod · 0.45

Tested by

no test coverage detected