-onlynet is documented to restrict automatic outbound connections, but it also currently prevents -externalip addresses from being advertised when their network is not in the -onlynet set. This happens because AddLocal() rejects addresses outside g_reachable_nets, regardless of whether the address was explicitly configured by the user.
Previous attempts to fix this (#24835 and #25690) removed the g_reachable_nets check from AddLocal().
This PR instead adds an explicit add_even_if_unreachable argument to AddLocal(). The argument defaults to false, and is set to true only when adding addresses from -externalip.
As a result, explicitly configured -externalip addresses can still be advertised even when their network is excluded by -onlynet, while discovered, mapped, bound, Tor control, and I2P SAM addresses continue to use the existing reachable-network filter.
This keeps the fix scoped to -externalip and addresses the concern raised in #25690:
I think it might also be weird for a user to activate -onlynet and keep on advertising their clearnet address to the network
The branch adds unit coverage for AddLocal() and functional coverage in p2p_addr_selfannouncement.py for -onlynet=ipv4 -externalip=<onion>.