From 3429d67014095b42a976d95c3ef8622d5fe085e6 Mon Sep 17 00:00:00 2001 From: Ryan Ofsky Date: Tue, 12 Apr 2022 03:00:28 -0400 Subject: init: Prevent -noproxy and -proxy=0 settings from interacting with other settings 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 baf05075fae2cc2625a2a74b35cc66902f3cbfa3 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. --- src/init.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/init.cpp b/src/init.cpp index 86e6ec4451..fdab296593 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -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__); -- cgit v1.2.3