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

Method SelectTriedCollision_

src/addrman.cpp:589–614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

587}
588
589CAddrInfo CAddrMan::SelectTriedCollision_()
590{
591 if (m_tried_collisions.size() == 0) return CAddrInfo();
592
593 std::set<int>::iterator it = m_tried_collisions.begin();
594
595 // Selects a random element from m_tried_collisions
596 std::advance(it, GetRandInt(m_tried_collisions.size()));
597 int id_new = *it;
598
599 // If id_new not found in mapInfo remove it from m_tried_collisions
600 if (mapInfo.count(id_new) != 1) {
601 m_tried_collisions.erase(it);
602 return CAddrInfo();
603 }
604
605 CAddrInfo& newInfo = mapInfo[id_new];
606
607 // which tried bucket to move the entry to
608 int tried_bucket = newInfo.GetTriedBucket(nKey);
609 int tried_bucket_pos = newInfo.GetBucketPosition(nKey, false, tried_bucket);
610
611 int id_old = vvTried[tried_bucket][tried_bucket_pos];
612
613 return mapInfo[id_old];
614}

Callers

nothing calls this directly

Calls 8

CAddrInfoClass · 0.85
GetRandIntFunction · 0.85
GetTriedBucketMethod · 0.80
GetBucketPositionMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
countMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected