diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2020-09-23 12:30:02 +0000 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2020-09-23 15:41:49 +0000 |
commit | 9b4fa0af40cd88ed25dd77962235fbf268bdcaa7 (patch) | |
tree | 90da0d2256ca9b3a2af3dacebed89fc28eb20619 | |
parent | 9e217f5a6f08c50aff9975aa4c079e2aab2fe371 (diff) |
net: Print error message if -proxy is specified without arguments (instead of continuing without proxy server)
-rw-r--r-- | src/init.cpp | 4 | ||||
-rwxr-xr-x | test/functional/feature_config_args.py | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp index 132acbfc81..ee9ec633b5 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1176,6 +1176,10 @@ bool AppInitParameterInteraction(const ArgsManager& args) nMaxTipAge = args.GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE); + if (args.IsArgSet("-proxy") && args.GetArg("-proxy", "").empty()) { + return InitError(_("No proxy server specified. Use -proxy=<ip> or -proxy=<ip:port>.")); + } + return true; } diff --git a/test/functional/feature_config_args.py b/test/functional/feature_config_args.py index 34e856c1ba..b4355a6587 100755 --- a/test/functional/feature_config_args.py +++ b/test/functional/feature_config_args.py @@ -78,6 +78,12 @@ class ConfArgsTest(BitcoinTestFramework): with open(inc_conf_file2_path, 'w', encoding='utf-8') as conf: conf.write('') # clear + def test_invalid_command_line_options(self): + self.nodes[0].assert_start_raises_init_error( + expected_msg='Error: No proxy server specified. Use -proxy=<ip> or -proxy=<ip:port>.', + extra_args=['-proxy'], + ) + def test_log_buffer(self): with self.nodes[0].assert_debug_log(expected_msgs=['Warning: parsed potentially confusing double-negative -connect=0\n']): self.start_node(0, extra_args=['-noconnect=0']) @@ -146,6 +152,7 @@ class ConfArgsTest(BitcoinTestFramework): self.test_networkactive() self.test_config_file_parser() + self.test_invalid_command_line_options() # Remove the -datadir argument so it doesn't override the config file self.nodes[0].args = [arg for arg in self.nodes[0].args if not arg.startswith("-datadir")] |