mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 07:39:08 +01:00
Normalize inconsistent -noonlynet behavior
Treat specifying -noonlynet the same as not specifying -onlynet, instead of marking all networks unreachable. Before this change, specifying -noonlynet cleared list of reachable networks and did not allow connecting to any network. It was basically an undocumented synonym for -noconnect. After this change, specifying -nononlynet just clears previously specifed -onlynet options and allows connecting to all networks, restoring default behavior as if no -onlynet options were specified. Before this change, there was no way to restore default behavior once an -onlynet option was specified. So for example, if a config file specifed onlynet settings, they couldn't be reset on the command line without disabling the entire config file. The previous -noonlynet behavior wasn't neccessarily bad, but it was undocumented, redundant with the -noconnect option, inconsistent with behavior of other list options, and inconsistent with being able to use the command line to selectively override config options. It was also probably unintended, arising from use of the IsArgSet() method and its interaction with negated options.
This commit is contained in:
@@ -403,7 +403,7 @@ void TorController::get_socks_cb(TorControlConnection& _conn, const TorControlRe
|
||||
const auto onlynets = gArgs.GetArgs("-onlynet");
|
||||
|
||||
const bool onion_allowed_by_onlynet{
|
||||
!gArgs.IsArgSet("-onlynet") ||
|
||||
onlynets.empty() ||
|
||||
std::any_of(onlynets.begin(), onlynets.end(), [](const auto& n) {
|
||||
return ParseNetwork(n) == NET_ONION;
|
||||
})};
|
||||
|
||||
Reference in New Issue
Block a user