diff options
author | Andrew Chow <github@achow101.com> | 2023-09-12 12:41:11 -0400 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2023-09-12 12:41:30 -0400 |
commit | adc0921ea19f3b06878df6b22393fec519ed8f91 (patch) | |
tree | 3bcae56c1a8a13e4b569545f4600e8dc9ead179d | |
parent | 8f9c74cb11d2016c84eea037533c1a131745fdc8 (diff) | |
parent | 9a84200cfc994eebf38c46919b20e0c0261799ae (diff) |
Merge bitcoin/bitcoin#28101: doc, refactor: changing -torcontrol help to specify that a default port is used
9a84200cfc994eebf38c46919b20e0c0261799ae doc, refactor: Changing -torcontrol help to specify that a default port is used (kevkevin)
Pull request description:
Right now when we get the help for -torcontrol it says that there is a default ip and port we dont specify if there is a specified ip that we would also use port 9051 as default
Also I create a new const instead of using 9051 directly in the function
linking this PR because this was discussed here https://github.com/bitcoin/bitcoin/pull/28018
ACKs for top commit:
jonatack:
re-ACK 9a84200cfc994eebf38c46919b20e0c0261799ae
achow101:
ACK 9a84200cfc994eebf38c46919b20e0c0261799ae
MarnixCroes:
utACK 9a84200cfc994eebf38c46919b20e0c0261799ae
kristapsk:
utACK 9a84200cfc994eebf38c46919b20e0c0261799ae
Tree-SHA512: 21d9e65f3c280a2853a9cf60d4e93e8d72caccea106206d1862c19535bde7ea6ada7f55e6ea19a1fc0f59dbe791ec6fc4084fdbe7fa6d6991fa89c62070db637
-rw-r--r-- | src/init.cpp | 2 | ||||
-rw-r--r-- | src/torcontrol.cpp | 6 | ||||
-rw-r--r-- | src/torcontrol.h | 1 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/init.cpp b/src/init.cpp index c025fb8ed8..1515007c54 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -510,7 +510,7 @@ void SetupServerArgs(ArgsManager& argsman) argsman.AddArg("-networkactive", "Enable all P2P network activity (default: 1). Can be changed by the setnetworkactive RPC command", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); argsman.AddArg("-timeout=<n>", strprintf("Specify socket connection timeout in milliseconds. If an initial attempt to connect is unsuccessful after this amount of time, drop it (minimum: 1, default: %d)", DEFAULT_CONNECT_TIMEOUT), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); argsman.AddArg("-peertimeout=<n>", strprintf("Specify a p2p connection timeout delay in seconds. After connecting to a peer, wait this amount of time before considering disconnection based on inactivity (minimum: 1, default: %d)", DEFAULT_PEER_CONNECT_TIMEOUT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CONNECTION); - argsman.AddArg("-torcontrol=<ip>:<port>", strprintf("Tor control port to use if onion listening enabled (default: %s)", DEFAULT_TOR_CONTROL), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); + argsman.AddArg("-torcontrol=<ip>:<port>", strprintf("Tor control host and port to use if onion listening enabled (default: %s). If no port is specified, the default port of %i will be used.", DEFAULT_TOR_CONTROL, DEFAULT_TOR_CONTROL_PORT), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION); argsman.AddArg("-torpassword=<pass>", "Tor control port password (default: empty)", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::CONNECTION); #ifdef USE_UPNP #if USE_UPNP diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp index 9cf976a700..4c99aa5746 100644 --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -42,8 +42,8 @@ #include <event2/thread.h> #include <event2/util.h> -/** Default control port */ -const std::string DEFAULT_TOR_CONTROL = "127.0.0.1:9051"; +/** Default control ip and port */ +const std::string DEFAULT_TOR_CONTROL = "127.0.0.1:" + ToString(DEFAULT_TOR_CONTROL_PORT); /** Tor cookie size (from control-spec.txt) */ static const int TOR_COOKIE_SIZE = 32; /** Size of client/server nonce for SAFECOOKIE */ @@ -144,7 +144,7 @@ bool TorControlConnection::Connect(const std::string& tor_control_center, const Disconnect(); } - const std::optional<CService> control_service{Lookup(tor_control_center, 9051, fNameLookup)}; + const std::optional<CService> control_service{Lookup(tor_control_center, DEFAULT_TOR_CONTROL_PORT, fNameLookup)}; if (!control_service.has_value()) { LogPrintf("tor: Failed to look up control center %s\n", tor_control_center); return false; diff --git a/src/torcontrol.h b/src/torcontrol.h index 1a9065b01a..4a0eef223e 100644 --- a/src/torcontrol.h +++ b/src/torcontrol.h @@ -19,6 +19,7 @@ #include <string> #include <vector> +constexpr int DEFAULT_TOR_CONTROL_PORT = 9051; extern const std::string DEFAULT_TOR_CONTROL; static const bool DEFAULT_LISTEN_ONION = true; |