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

Method GetNewBucket

src/addrman.cpp:36–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36int AddrInfo::GetNewBucket(const uint256& nKey, const CNetAddr& src, const NetGroupManager& netgroupman) const
37{
38 std::vector<unsigned char> vchSourceGroupKey = netgroupman.GetGroup(src);
39 uint64_t hash1 = (HashWriter{} << nKey << netgroupman.GetGroup(*this) << vchSourceGroupKey).GetCheapHash();
40 uint64_t hash2 = (HashWriter{} << nKey << vchSourceGroupKey << (hash1 % ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP)).GetCheapHash();
41 return hash2 % ADDRMAN_NEW_BUCKET_COUNT;
42}
43
44int AddrInfo::GetBucketPosition(const uint256& nKey, bool fNew, int bucket) const
45{

Callers 5

UnserializeMethod · 0.45
MakeTriedMethod · 0.45
AddSingleMethod · 0.45
FindAddressEntry_Method · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45

Calls 2

GetGroupMethod · 0.80
GetCheapHashMethod · 0.80

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.36