Fixes #13378
If set onlynet=ipv4 or onlynet=ipv6 (implicating the attempt to disable onion network) without this patch, Bitcoin Core would re-enable onion network (setting onion network to status “reachable”, when it was initially set to “unreachable” (aka “limited” in the code). This happened when proxy or onion parameters where set, or when listenonion was set to 1 (which is the default).
I think, the users initial choice of disabling onion network should be honored instead of quietly being overwritten.
I have testet with
onlynet=ipv4
onlynet=ipv6
onlynet=onion
(each for itself, no multiple onlynet settings)
and without specifying onlynet
With this patch, the node only connects to the specified network (or to all networks in the last test case)