| 954 | } |
| 955 | |
| 956 | std::pair<CAddress, NodeSeconds> AddrManImpl::SelectTriedCollision_() |
| 957 | { |
| 958 | AssertLockHeld(cs); |
| 959 | |
| 960 | if (m_tried_collisions.size() == 0) return {}; |
| 961 | |
| 962 | std::set<nid_type>::iterator it = m_tried_collisions.begin(); |
| 963 | |
| 964 | // Selects a random element from m_tried_collisions |
| 965 | std::advance(it, insecure_rand.randrange(m_tried_collisions.size())); |
| 966 | nid_type id_new = *it; |
| 967 | |
| 968 | // If id_new not found in mapInfo remove it from m_tried_collisions |
| 969 | if (!mapInfo.contains(id_new)) { |
| 970 | m_tried_collisions.erase(it); |
| 971 | return {}; |
| 972 | } |
| 973 | |
| 974 | const AddrInfo& newInfo = mapInfo[id_new]; |
| 975 | |
| 976 | // which tried bucket to move the entry to |
| 977 | int tried_bucket = newInfo.GetTriedBucket(nKey, m_netgroupman); |
| 978 | int tried_bucket_pos = newInfo.GetBucketPosition(nKey, false, tried_bucket); |
| 979 | |
| 980 | const AddrInfo& info_old = mapInfo[vvTried[tried_bucket][tried_bucket_pos]]; |
| 981 | return {info_old, info_old.m_last_try}; |
| 982 | } |
| 983 | |
| 984 | std::optional<AddressPosition> AddrManImpl::FindAddressEntry_(const CAddress& addr) |
| 985 | { |
nothing calls this directly
no test coverage detected