0diff --git i/src/init.cpp w/src/init.cpp
1index c10f792c7d..7e141dbd4c 100644
2--- i/src/init.cpp
3+++ w/src/init.cpp
4@@ -518,13 +518,13 @@ void SetupServerArgs(ArgsManager& argsman, bool can_listen_ipc)
5 " If <type> is not supplied or if <type> = 1, indexes for all known types are enabled.",
6 ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
7
8 argsman.AddArg("-addnode=<ip>", strprintf("Add a node to connect to and attempt to keep the connection open (see the addnode RPC help for more info). This option can be specified multiple times to add multiple nodes; connections are limited to %u at a time and are counted separately from the -maxconnections limit.", MAX_ADDNODE_CONNECTIONS), ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION);
9 argsman.AddArg("-asmap=<file>", strprintf("Specify asn mapping used for bucketing of the peers (default: %s). Relative paths will be prefixed by the net-specific datadir location.", DEFAULT_ASMAP_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
10 argsman.AddArg("-bantime=<n>", strprintf("Default duration (in seconds) of manually configured bans (default: %u)", DEFAULT_MISBEHAVING_BANTIME), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
11- argsman.AddArg("-bind=<addr>[:<port>][=onion]", strprintf("Bind to given address and always listen on it (default: 0.0.0.0). Use [host]:port notation for IPv6. Append =onion to tag any incoming connections to that address and port as incoming Tor connections (default: 127.0.0.1:%u=onion, testnet3: 127.0.0.1:%u=onion, testnet4: 127.0.0.1:%u=onion, signet: 127.0.0.1:%u=onion, regtest: 127.0.0.1:%u=onion)", defaultBaseParams->OnionServiceTargetPort(), testnetBaseParams->OnionServiceTargetPort(), testnet4BaseParams->OnionServiceTargetPort(), signetBaseParams->OnionServiceTargetPort(), regtestBaseParams->OnionServiceTargetPort()), ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION);
12+ argsman.AddArg("-bind=<addr>[:<port>][=onion]", strprintf("Bind to given address and always listen on it (default: 0.0.0.0). Use [host]:port notation for IPv6. Append =onion to tag any incoming connections to that address and port as incoming Tor connections (default: 127.0.0.1:%u=onion, testnet3: 127.0.0.1:%u=onion, testnet4: 127.0.0.1:%u=onion, signet: 127.0.0.1:%u=onion, regtest: 127.0.0.1:%u=onion)", defaultChainParams->GetDefaultPort() + 1, testnetChainParams->GetDefaultPort() + 1, testnet4ChainParams->GetDefaultPort() + 1, signetChainParams->GetDefaultPort() + 1, regtestChainParams->GetDefaultPort() + 1), ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION);
13 argsman.AddArg("-cjdnsreachable", "If set, then this host is configured for CJDNS (connecting to fc00::/8 addresses would lead us to the CJDNS network, see doc/cjdns.md) (default: 0)", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
14 argsman.AddArg("-connect=<ip>", "Connect only to the specified node; -noconnect disables automatic connections (the rules for this peer are the same as for -addnode). This option can be specified multiple times to connect to multiple nodes.", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION);
15 argsman.AddArg("-discover", "Discover own IP addresses (default: 1 when listening and no -externalip or -proxy)", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
16 argsman.AddArg("-dns", strprintf("Allow DNS lookups for -addnode, -seednode and -connect (default: %u)", DEFAULT_NAME_LOOKUP), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
17 argsman.AddArg("-dnsseed", strprintf("Query for peer addresses via DNS lookup, if low on addresses (default: %u unless -connect used or -maxconnections=0)", DEFAULT_DNSSEED), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
18 argsman.AddArg("-externalip=<ip>", "Specify your own public address", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
19@@ -1844,12 +1844,14 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
20 connOptions.whitelist_relay = args.GetBoolArg("-whitelistrelay", DEFAULT_WHITELISTRELAY);
21
22 // Port to bind to if `-bind=addr` is provided without a `:port` suffix.
23 const uint16_t default_bind_port =
24 static_cast<uint16_t>(args.GetIntArg("-port", Params().GetDefaultPort()));
25
26+ const uint16_t default_bind_port_onion = default_bind_port + 1;
27+
28 const auto BadPortWarning = [](const char* prefix, uint16_t port) {
29 return strprintf(_("%s request to listen on port %u. This port is considered \"bad\" and "
30 "thus it is unlikely that any peer will connect to it. See "
31 "doc/p2p-bad-ports.md for details and a full list."),
32 prefix,
33 port);
34@@ -1868,13 +1870,13 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
35 continue;
36 }
37 } else {
38 const std::string network_type = bind_arg.substr(index + 1);
39 if (network_type == "onion") {
40 const std::string truncated_bind_arg = bind_arg.substr(0, index);
41- bind_addr = Lookup(truncated_bind_arg, BaseParams().OnionServiceTargetPort(), false);
42+ bind_addr = Lookup(truncated_bind_arg, default_bind_port_onion, false);
43 if (bind_addr.has_value()) {
44 connOptions.onion_binds.push_back(bind_addr.value());
45 continue;
46 }
47 }
48 }
49@@ -1904,22 +1906,13 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
50 CService onion_service_target;
51 if (!connOptions.onion_binds.empty()) {
52 onion_service_target = connOptions.onion_binds.front();
53 } else if (!connOptions.vBinds.empty()) {
54 onion_service_target = connOptions.vBinds.front();
55 } else {
56- std::optional<uint16_t> onion_port;
57- if (args.IsArgSet("-port")) {
58- // If -port was specified but no onion bind, derive the onion listening port by incrementing
59- // that port by 1. This avoids port collisions in case of setups with multiple local nodes.
60- onion_port = args.GetIntArg("-port", 0) + 1;
61- if (IsBadPort(*onion_port)) {
62- InitWarning(BadPortWarning("-port", *onion_port));
63- }
64- }
65- onion_service_target = DefaultOnionServiceTarget(onion_port);
66+ onion_service_target = DefaultOnionServiceTarget(default_bind_port_onion);
67 connOptions.onion_binds.push_back(onion_service_target);
68 }
69
70 if (args.GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION)) {
71 if (connOptions.onion_binds.size() > 1) {
72 InitWarning(strprintf(_("More than one onion bind address is provided. Using %s "
73diff --git i/src/torcontrol.h w/src/torcontrol.h
74index f57bf9e65f..0b66201cf1 100644
75--- i/src/torcontrol.h
76+++ w/src/torcontrol.h
77@@ -24,13 +24,13 @@ extern const std::string DEFAULT_TOR_CONTROL;
78 static const bool DEFAULT_LISTEN_ONION = true;
79
80 void StartTorControl(CService onion_service_target);
81 void InterruptTorControl();
82 void StopTorControl();
83
84-CService DefaultOnionServiceTarget(std::optional<uint16_t> port);
85+CService DefaultOnionServiceTarget(uint16_t port);
86
87 /** Reply from Tor, can be single or multi-line */
88 class TorControlReply
89 {
90 public:
91 TorControlReply() { Clear(); }
92diff --git i/src/torcontrol.cpp w/src/torcontrol.cpp
93index d56216a7cb..60df916f16 100644
94--- i/src/torcontrol.cpp
95+++ w/src/torcontrol.cpp
96@@ -708,12 +708,12 @@ void StopTorControl()
97 torControlThread.join();
98 event_base_free(gBase);
99 gBase = nullptr;
100 }
101 }
102
103-CService DefaultOnionServiceTarget(std::optional<uint16_t> port)
104+CService DefaultOnionServiceTarget(uint16_t port)
105 {
106 struct in_addr onion_service_target;
107 onion_service_target.s_addr = htonl(INADDR_LOOPBACK);
108- return {onion_service_target, port.has_value() ? port.value() : BaseParams().OnionServiceTargetPort()};
109+ return {onion_service_target, port};
110 }
111diff --git i/src/chainparamsbase.h w/src/chainparamsbase.h
112index c75a70cb96..adbd6a5174 100644
113--- i/src/chainparamsbase.h
114+++ w/src/chainparamsbase.h
115@@ -19,21 +19,19 @@ class ArgsManager;
116 */
117 class CBaseChainParams
118 {
119 public:
120 const std::string& DataDir() const { return strDataDir; }
121 uint16_t RPCPort() const { return m_rpc_port; }
122- uint16_t OnionServiceTargetPort() const { return m_onion_service_target_port; }
123
124 CBaseChainParams() = delete;
125- CBaseChainParams(const std::string& data_dir, uint16_t rpc_port, uint16_t onion_service_target_port)
126- : m_rpc_port(rpc_port), m_onion_service_target_port(onion_service_target_port), strDataDir(data_dir) {}
127+ CBaseChainParams(const std::string& data_dir, uint16_t rpc_port)
128+ : m_rpc_port(rpc_port), strDataDir(data_dir) {}
129
130 private:
131 const uint16_t m_rpc_port;
132- const uint16_t m_onion_service_target_port;
133 std::string strDataDir;
134 };
135
136 /**
137 * Creates and returns a std::unique_ptr<CBaseChainParams> of the chosen chain.
138 */
139diff --git i/src/chainparamsbase.cpp w/src/chainparamsbase.cpp
140index aadd04e509..060d519d92 100644
141--- i/src/chainparamsbase.cpp
142+++ w/src/chainparamsbase.cpp
143@@ -38,21 +38,21 @@ const CBaseChainParams& BaseParams()
144 * been chosen arbitrarily to keep ranges of used ports tight.
145 */
146 std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const ChainType chain)
147 {
148 switch (chain) {
149 case ChainType::MAIN:
150- return std::make_unique<CBaseChainParams>("", 8332, 8334);
151+ return std::make_unique<CBaseChainParams>("", 8332);
152 case ChainType::TESTNET:
153- return std::make_unique<CBaseChainParams>("testnet3", 18332, 18334);
154+ return std::make_unique<CBaseChainParams>("testnet3", 18332);
155 case ChainType::TESTNET4:
156- return std::make_unique<CBaseChainParams>("testnet4", 48332, 48334);
157+ return std::make_unique<CBaseChainParams>("testnet4", 48332);
158 case ChainType::SIGNET:
159- return std::make_unique<CBaseChainParams>("signet", 38332, 38334);
160+ return std::make_unique<CBaseChainParams>("signet", 38332);
161 case ChainType::REGTEST:
162- return std::make_unique<CBaseChainParams>("regtest", 18443, 18445);
163+ return std::make_unique<CBaseChainParams>("regtest", 18443);
164 }
165 assert(false);
166 }
167
168 void SelectBaseParams(const ChainType chain)
169 {