|
3 | 3 | // Distributed under the MIT software license, see the accompanying
|
4 | 4 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
5 | 5 |
|
| 6 | +#include <chainparams.h> |
6 | 7 | #include <torcontrol.h>
|
7 | 8 | #include <util/strencodings.h>
|
8 | 9 | #include <netbase.h>
|
@@ -500,7 +501,7 @@ void TorController::add_onion_cb(TorControlConnection& _conn, const TorControlRe
|
500 | 501 | }
|
501 | 502 | return;
|
502 | 503 | }
|
503 |
| - service = LookupNumeric(std::string(service_id+".onion").c_str(), GetListenPort()); |
| 504 | + service = LookupNumeric(std::string(service_id+".onion").c_str(), Params().GetDefaultPort()); |
504 | 505 | LogPrintf("tor: Got service ID %s, advertising service %s\n", service_id, service.ToString());
|
505 | 506 | if (WriteBinaryFile(GetPrivateKeyFile(), private_key)) {
|
506 | 507 | LogPrint(BCLog::TOR, "tor: Cached service private key to %s\n", GetPrivateKeyFile().string());
|
@@ -534,9 +535,8 @@ void TorController::auth_cb(TorControlConnection& _conn, const TorControlReply&
|
534 | 535 | if (private_key.empty()) // No private key, generate one
|
535 | 536 | private_key = "NEW:RSA1024"; // Explicitly request RSA1024 - see issue #9214
|
536 | 537 | // Request hidden service, redirect port.
|
537 |
| - // Note that the 'virtual' port doesn't have to be the same as our internal port, but this is just a convenient |
538 |
| - // choice. TODO; refactor the shutdown sequence some day. |
539 |
| - _conn.Command(strprintf("ADD_ONION %s Port=%i,127.0.0.1:%i", private_key, GetListenPort(), GetListenPort()), |
| 538 | + // Note that the 'virtual' port is always the default port to avoid decloaking nodes using other ports. |
| 539 | + _conn.Command(strprintf("ADD_ONION %s Port=%i,127.0.0.1:%i", private_key, Params().GetDefaultPort(), GetListenPort()), |
540 | 540 | std::bind(&TorController::add_onion_cb, this, std::placeholders::_1, std::placeholders::_2));
|
541 | 541 | } else {
|
542 | 542 | LogPrintf("tor: Authentication failed\n");
|
|
0 commit comments