mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Merge #20003: net: Exit with error message if -proxy is specified without arguments (instead of continuing without proxy server)
9b4fa0af40cd88ed25dd77962235fbf268bdcaa7 net: Print error message if -proxy is specified without arguments (instead of continuing without proxy server) (practicalswift) Pull request description: Exit with error message if `-proxy` is specified without arguments (instead of continuing without proxy server). Continuing without a proxy server when the end-user has specified `-proxy` may result in accidental loss of privacy. (The end-user might think he/she is using a proxy when he/she is not.) Before this patch: ``` $ src/bitcoind -proxy … 2020-09-23T00:24:33Z InitParameterInteraction: parameter interaction: -proxy set -> setting -listen=0 2020-09-23T00:24:33Z InitParameterInteraction: parameter interaction: -proxy set -> setting -upnp=0 2020-09-23T00:24:33Z InitParameterInteraction: parameter interaction: -proxy set -> setting -discover=0 2020-09-23T00:24:33Z InitParameterInteraction: parameter interaction: -listen=0 -> setting -listenonion=0 … 2020-09-23T00:24:33Z init message: Starting network threads... ``` `bitcoind` is now running *without* a proxy server (`GetProxy(…, …) == false`, `HaveNameProxy() == false`, etc.). Note that the "-proxy set" log messages above which the end-user might interpret as "good, my traffic is now routed via the proxy". After this patch: ``` $ src/bitcoind -proxy Error: No proxy server specified. Use -proxy=<ip> or -proxy=<ip:port>. $ echo $? 1 ``` ACKs for top commit: laanwj: re-ACK 9b4fa0af40cd88ed25dd77962235fbf268bdcaa7 kristapsk: ACK 9b4fa0af40cd88ed25dd77962235fbf268bdcaa7, I have tested the code. hebasto: re-ACK 9b4fa0af40cd88ed25dd77962235fbf268bdcaa7 Tree-SHA512: 4ba7a011991699a54b5bb87ec68367c681231bf5dcd36f8c89ff9ddc2e8d29df453817b7e362597e652ad6b341a22b7274be0fd78d435e5f0fd8058e5221c4ce
This commit is contained in:
parent
a5cb057927
commit
4293cbdb53
@ -1419,6 +1419,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>."));
|
||||
}
|
||||
|
||||
try {
|
||||
const bool fRecoveryEnabled{llmq::utils::QuorumDataRecoveryEnabled()};
|
||||
const bool fQuorumVvecRequestsEnabled{llmq::utils::GetEnabledQuorumVvecSyncEntries().size() > 0};
|
||||
|
@ -81,6 +81,11 @@ 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']):
|
||||
@ -124,6 +129,7 @@ class ConfArgsTest(BitcoinTestFramework):
|
||||
|
||||
|
||||
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")]
|
||||
|
Loading…
Reference in New Issue
Block a user