MCPcopy Create free account
hub / github.com/ElementsProject/elements / GetNewBucket

Method GetNewBucket

src/addrman.cpp:53–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53int AddrInfo::GetNewBucket(const uint256& nKey, const CNetAddr& src, const std::vector<bool>& asmap) const
54{
55 std::vector<unsigned char> vchSourceGroupKey = src.GetGroup(asmap);
56 uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetGroup(asmap) << vchSourceGroupKey).GetCheapHash();
57 uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey << vchSourceGroupKey << (hash1 % ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP)).GetCheapHash();
58 return hash2 % ADDRMAN_NEW_BUCKET_COUNT;
59}
60
61int AddrInfo::GetBucketPosition(const uint256& nKey, bool fNew, int nBucket) const
62{

Callers 5

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

Calls 3

CHashWriterClass · 0.85
GetGroupMethod · 0.80
GetCheapHashMethod · 0.80

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.36