See https://github.com/bitcoin/bitcoin/pull/22762#issuecomment-951063826

This can be fixed by creating a new exception type and catching it in the right place.

#### Useful skills:

* C++ exceptions
* Addrman serialization
* Functional tests

#### Want to work on this issue?

For guidance on contributing, please read [CONTRIBUTING.md](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md) before opening your pull request.

{
    AssertLockHeld(cs);
    if (m_tried_collisions.size() == 0) return {};
    std::set<int>::iterator it = m_tried_collisions.begin();
    
    std::advance(it, insecure_rand.randrange(m_tried_collisions.size()));
    int id_new = *it;
    
    if (mapInfo.count(id_new) != 1) {
        m_tried_collisions.erase(it);
        return {};
    }
    const AddrInfo& newInfo = mapInfo[id_new];
    
    int tried_bucket = newInfo.GetTriedBucket(nKey, m_asmap);
    int tried_bucket_pos = newInfo.GetBucketPosition(nKey, false, tried_bucket);
    const AddrInfo& info_old = mapInfo[vvTried[tried_bucket][tried_bucket_pos]];
    return {info_old, info_old.nLastTry};
}
std::optional<AddressPosition> AddrManImpl::FindAddressEntry_(const CAddress& addr)