MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / GetNewBucket

Method GetNewBucket

src/addrman.cpp:19–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19int CAddrInfo::GetNewBucket(const uint256& nKey, const CNetAddr& src) const
20{
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();
24 return hash2 % ADDRMAN_NEW_BUCKET_COUNT;
25}
26
27int CAddrInfo::GetBucketPosition(const uint256 &nKey, bool fNew, int nBucket) const
28{

Callers 3

MakeTriedMethod · 0.45
Add_Method · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45

Calls 4

CHashWriterClass · 0.85
GetGroupMethod · 0.80
GetCheapHashMethod · 0.80
GetHashMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.36