From 94df26a0e0ced747ec316bee8c951b401bda0c9e Mon Sep 17 00:00:00 2001 From: Sami Ahmed Date: Thu, 9 Apr 2026 21:59:34 -0700 Subject: [PATCH] Fix Tor startup: remove false-positive port collision check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The defensive check `IsPortInUse(hiddenServicePort)` always fails because port 24112 is the P2P port, which the node binds BEFORE Tor starts. The check was incorrectly detecting our own listener as a collision, causing "Tor failed to start" on every launch. The hidden service is supposed to forward to 127.0.0.1:24112 where the node is already listening — that's the correct state, not an error. Co-Authored-By: Claude Opus 4.6 --- src/tor/tor_process.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/tor/tor_process.cpp b/src/tor/tor_process.cpp index 8d12294..ed84081 100644 --- a/src/tor/tor_process.cpp +++ b/src/tor/tor_process.cpp @@ -360,18 +360,6 @@ bool CTorProcess::Start(const std::string& dataDir, int socks, int hsPort, bool if (IsPortInUse(socksPort)) { printf("Tor SOCKS proxy ready on port %d (took %ds)\n", socksPort, i + 1); - // Defensive check: Tor must not directly occupy the node's hidden-service - // virtual port. If it does, node startup will fail with a bind collision. - if (hiddenServiceEnabled && IsPortInUse(hiddenServicePort)) { - lastError = strprintf("Port %d is already busy while Tor hidden service is enabled. Another process is likely blocking the node listener.", hiddenServicePort); - printf("ERROR: Tor startup collision: hidden service port %d appears busy before node bind.\n", - hiddenServicePort); - printf(" Refusing to treat Tor as healthy because this would block the node listener.\n"); - Stop(); - running = false; - return false; - } - // Read and display the hidden service hostname if available if (hiddenServiceEnabled) { fs::path hsHostname = fs::path(torDataDir) / "hidden_service" / "hostname";