mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +01:00
net, init: derive default onion port if a user specified a -port
After port collisions are no longer tolerated but lead to
a startup failure in v28.0, local setups of multiple nodes,
each with a different -port value would not be possible anymore
due to collision of the onion default port - even if the nodes
were using tor or not interested in receiving onion inbound connections.
Fix this by deriving the onion listening port to be -port + 1.
(idea by vasild / laanwj)
Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
Github-Pull: bitcoin/bitcoin#31223
Rebased-From: 0e2b12b92a
This commit is contained in:
committed by
Ava Chow
parent
227642d5af
commit
bbde830b97
@@ -711,9 +711,9 @@ void StopTorControl()
|
||||
}
|
||||
}
|
||||
|
||||
CService DefaultOnionServiceTarget()
|
||||
CService DefaultOnionServiceTarget(uint16_t port)
|
||||
{
|
||||
struct in_addr onion_service_target;
|
||||
onion_service_target.s_addr = htonl(INADDR_LOOPBACK);
|
||||
return {onion_service_target, BaseParams().OnionServiceTargetPort()};
|
||||
return {onion_service_target, port};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user