Skip to content

Commit

Permalink
Merge pull request #7090
Browse files Browse the repository at this point in the history
cde857f Connect to Tor hidden services by default (Peter Todd)
  • Loading branch information
laanwj committed Nov 27, 2015
2 parents d8368a0 + cde857f commit d6454f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 5 additions & 4 deletions doc/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,18 @@ mining with the getblocktemplate protocol to a pool: this will affect you at
the pool operator's discretion, which must be no later than BIP65 achieving its
951/1001 status.

Automatically listen on Tor
----------------------------
Automatically use Tor hidden services
-------------------------------------

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

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

This new feature is enabled by default if Bitcoin Core is listening, and
a connection to Tor can be made. It can be configured with the `-listenonion`,
Expand Down
9 changes: 9 additions & 0 deletions src/torcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,15 @@ void TorController::auth_cb(TorControlConnection& conn, const TorControlReply& r
{
if (reply.code == 250) {
LogPrint("tor", "tor: Authentication succesful\n");

// Now that we know Tor is running setup the proxy for onion addresses
// if -onion isn't set to something else.
if (GetArg("-onion", "") == "") {
proxyType addrOnion = proxyType(CService("127.0.0.1", 9050), true);
SetProxy(NET_TOR, addrOnion);
SetReachable(NET_TOR);
}

// Finally - now create the service
if (private_key.empty()) // No private key, generate one
private_key = "NEW:BEST";
Expand Down

0 comments on commit d6454f6

Please sign in to comment.