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

Method GetNewBucket

src/addrman.cpp:18–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18int CAddrInfo::GetNewBucket(const uint256& nKey, const CNetAddr& src) const
19{
20 std::vector<unsigned char> vchSourceGroupKey = src.GetGroup();
21 uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetGroup() << vchSourceGroupKey).GetHash().GetCheapHash();
22 uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey << vchSourceGroupKey << (hash1 % ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP)).GetHash().GetCheapHash();
23 return hash2 % ADDRMAN_NEW_BUCKET_COUNT;
24}
25
26int CAddrInfo::GetBucketPosition(const uint256 &nKey, bool fNew, int nBucket) const
27{

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