| 903 | } |
| 904 | |
| 905 | std::pair<CAddress, int64_t> AddrManImpl::SelectTriedCollision_() |
| 906 | { |
| 907 | AssertLockHeld(cs); |
| 908 | |
| 909 | if (m_tried_collisions.size() == 0) return {}; |
| 910 | |
| 911 | std::set<nid_type>::iterator it = m_tried_collisions.begin(); |
| 912 | |
| 913 | // Selects a random element from m_tried_collisions |
| 914 | std::advance(it, insecure_rand.randrange(m_tried_collisions.size())); |
| 915 | nid_type id_new = *it; |
| 916 | |
| 917 | // If id_new not found in mapInfo remove it from m_tried_collisions |
| 918 | if (mapInfo.count(id_new) != 1) { |
| 919 | m_tried_collisions.erase(it); |
| 920 | return {}; |
| 921 | } |
| 922 | |
| 923 | const AddrInfo& newInfo = mapInfo[id_new]; |
| 924 | |
| 925 | // which tried bucket to move the entry to |
| 926 | int tried_bucket = newInfo.GetTriedBucket(nKey, m_asmap); |
| 927 | int tried_bucket_pos = newInfo.GetBucketPosition(nKey, false, tried_bucket); |
| 928 | |
| 929 | const AddrInfo& info_old = mapInfo[vvTried[tried_bucket][tried_bucket_pos]]; |
| 930 | return {info_old, info_old.nLastTry}; |
| 931 | } |
| 932 | |
| 933 | std::optional<AddressPosition> AddrManImpl::FindAddressEntry_(const CAddress& addr) |
| 934 | { |
nothing calls this directly
no test coverage detected