Merge bitcoin/bitcoin#24837: init: Prevent -noproxy and -proxy=0 from interacting with other settings

3429d67014 init: Prevent -noproxy and -proxy=0 settings from interacting with other settings (Ryan Ofsky)

Pull request description:

  Prevent `-noproxy` and `-proxy=0` settings from interacting with `-listen`, `-upnp`, and `-natpmp` settings.

  These settings started being handled inconsistently in the `AppInitMain` and `InitParameterInteraction` functions starting in commit baf05075fa from #6272:

  https://github.com/bitcoin/bitcoin/blob/baf05075fae2cc2625a2a74b35cc66902f3cbfa3/src/init.cpp#L990-L991
  https://github.com/bitcoin/bitcoin/blob/baf05075fae2cc2625a2a74b35cc66902f3cbfa3/src/init.cpp#L687

  This commit changes both functions to handle proxy arguments the same way so
  there are not side effects from specifying a proxy=0 setting.

  This change was originally part of #24830 but really is independent and makes more sense as a separate PR

ACKs for top commit:
  hebasto:
    ACK 3429d67014, tested on Ubuntu 22.04.

Tree-SHA512: c4c6b4aeb3c07321700e974c16fd47a1bd3d469f273a6b308a69638db81c88c4e67208fddc96fcda9c8bd85f3ae22c98ca131c9622895edaa34eb65c194f35db
This commit is contained in:
MarcoFalke committed 2022-04-17 13:41:16 +02:00
commit 2074d7df20
1 file changed
+2 -1
+2 -1
View File
@@ -660,7 +660,8 @@ void InitParameterInteraction(ArgsManager& args)
LogPrintf("%s: parameter interaction: -connect set -> setting -listen=0\n", __func__);
}
if (args.IsArgSet("-proxy")) {
std::string proxy_arg = args.GetArg("-proxy", "");
if (proxy_arg != "" && proxy_arg != "0") {
// to protect privacy, do not listen by default if a default proxy server is specified
if (args.SoftSetBoolArg("-listen", false))
LogPrintf("%s: parameter interaction: -proxy set -> setting -listen=0\n", __func__);