Skip to content

Commit d6454f6

Browse files
committed
Merge pull request #7090
cde857f Connect to Tor hidden services by default (Peter Todd)
2 parents d8368a0 + cde857f commit d6454f6

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

doc/release-notes.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,18 @@ mining with the getblocktemplate protocol to a pool: this will affect you at
151151
the pool operator's discretion, which must be no later than BIP65 achieving its
152152
951/1001 status.
153153

154-
Automatically listen on Tor
155-
----------------------------
154+
Automatically use Tor hidden services
155+
-------------------------------------
156156

157157
Starting with Tor version 0.2.7.1 it is possible, through Tor's control socket
158158
API, to create and destroy 'ephemeral' hidden services programmatically.
159159
Bitcoin Core has been updated to make use of this.
160160

161161
This means that if Tor is running (and proper authorization is available),
162162
Bitcoin Core automatically creates a hidden service to listen on, without
163-
manual configuration. This will positively affect the number of available
164-
.onion nodes.
163+
manual configuration. Bitcoin Core will also use Tor automatically to connect
164+
to other .onion nodes if the control socket can be successfully opened. This
165+
will positively affect the number of available .onion nodes and their usage.
165166

166167
This new feature is enabled by default if Bitcoin Core is listening, and
167168
a connection to Tor can be made. It can be configured with the `-listenonion`,

src/torcontrol.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,15 @@ void TorController::auth_cb(TorControlConnection& conn, const TorControlReply& r
449449
{
450450
if (reply.code == 250) {
451451
LogPrint("tor", "tor: Authentication succesful\n");
452+
453+
// Now that we know Tor is running setup the proxy for onion addresses
454+
// if -onion isn't set to something else.
455+
if (GetArg("-onion", "") == "") {
456+
proxyType addrOnion = proxyType(CService("127.0.0.1", 9050), true);
457+
SetProxy(NET_TOR, addrOnion);
458+
SetReachable(NET_TOR);
459+
}
460+
452461
// Finally - now create the service
453462
if (private_key.empty()) // No private key, generate one
454463
private_key = "NEW:BEST";

0 commit comments

Comments
 (0)