mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-12 13:43:43 +01:00
net: don't extra bind for Tor if binds are restricted
If only `-bind=addr:port` is given (without `-bind=...=onion`) then we would bind to `addr:port` _and_ to `127.0.0.1:8334` in addition which may be unexpected, assuming the semantic of `-bind=addr:port` is "bind _only_ to `addr:port`". Change the above to not do the additional bind: if only `-bind=addr:port` is given (without `-bind=...=onion`) then bind to `addr:port` (only). If we are creating a Tor hidden service then use `addr:port` as target (same behavior as before https://github.com/bitcoin/bitcoin/pull/19991). This allows disabling binding on the onion port. Fixes https://github.com/bitcoin/bitcoin/issues/22726
This commit is contained in:
@@ -1890,6 +1890,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
CService onion_service_target;
|
||||
if (!connOptions.onion_binds.empty()) {
|
||||
onion_service_target = connOptions.onion_binds.front();
|
||||
} else if (!connOptions.vBinds.empty()) {
|
||||
onion_service_target = connOptions.vBinds.front();
|
||||
} else {
|
||||
onion_service_target = DefaultOnionServiceTarget();
|
||||
connOptions.onion_binds.push_back(onion_service_target);
|
||||
|
||||
Reference in New Issue
Block a user