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

Method GetTriedBucket

src/addrman.cpp:46–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44static constexpr int64_t ADDRMAN_TEST_WINDOW{40*60}; // 40 minutes
45
46int AddrInfo::GetTriedBucket(const uint256& nKey, const std::vector<bool>& asmap) const
47{
48 uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << GetKey()).GetCheapHash();
49 uint64_t hash2 = (CHashWriter(SER_GETHASH, 0) << nKey << GetGroup(asmap) << (hash1 % ADDRMAN_TRIED_BUCKETS_PER_GROUP)).GetCheapHash();
50 return hash2 % ADDRMAN_TRIED_BUCKET_COUNT;
51}
52
53int AddrInfo::GetNewBucket(const uint256& nKey, const CNetAddr& src, const std::vector<bool>& asmap) const
54{

Callers 8

UnserializeMethod · 0.80
MakeTriedMethod · 0.80
Good_Method · 0.80
ResolveCollisions_Method · 0.80
SelectTriedCollision_Method · 0.80
FindAddressEntry_Method · 0.80
CheckAddrmanMethod · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 2

CHashWriterClass · 0.85
GetCheapHashMethod · 0.80

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.64