remove -tor compatibility code (only allow -onion)

- exit, if -tor option is found and give error to user
This commit is contained in:
Philip Kaufmann 2014-05-05 20:32:56 +02:00
parent 36db6633c3
commit 1c750dbd40

View File

@ -560,6 +560,9 @@ bool AppInit2(boost::thread_group& threadGroup)
// Check for -debugnet (deprecated) // Check for -debugnet (deprecated)
if (GetBoolArg("-debugnet", false)) if (GetBoolArg("-debugnet", false))
InitWarning(_("Warning: Deprecated argument -debugnet ignored, use -debug=net")); InitWarning(_("Warning: Deprecated argument -debugnet ignored, use -debug=net"));
// Check for -tor - as this is a privacy risk to continue, exit here
if (GetBoolArg("-tor", false))
return InitError(_("Error: Unsupported argument -tor found, use -onion."));
fBenchmark = GetBoolArg("-benchmark", false); fBenchmark = GetBoolArg("-benchmark", false);
// Checkmempool defaults to true in regtest mode // Checkmempool defaults to true in regtest mode
@ -766,19 +769,15 @@ bool AppInit2(boost::thread_group& threadGroup)
} }
// -onion can override normal proxy, -noonion disables tor entirely // -onion can override normal proxy, -noonion disables tor entirely
// -tor here is a temporary backwards compatibility measure
if (mapArgs.count("-tor"))
printf("Notice: option -tor has been replaced with -onion and will be removed in a later version.\n");
if (!(mapArgs.count("-onion") && mapArgs["-onion"] == "0") && if (!(mapArgs.count("-onion") && mapArgs["-onion"] == "0") &&
!(mapArgs.count("-tor") && mapArgs["-tor"] == "0") && (fProxy || mapArgs.count("-onion"))) {
(fProxy || mapArgs.count("-onion") || mapArgs.count("-tor"))) {
CService addrOnion; CService addrOnion;
if (!mapArgs.count("-onion") && !mapArgs.count("-tor")) if (!mapArgs.count("-onion"))
addrOnion = addrProxy; addrOnion = addrProxy;
else else
addrOnion = mapArgs.count("-onion")?CService(mapArgs["-onion"], 9050):CService(mapArgs["-tor"], 9050); addrOnion = CService(mapArgs["-onion"], 9050);
if (!addrOnion.IsValid()) if (!addrOnion.IsValid())
return InitError(strprintf(_("Invalid -onion address: '%s'"), mapArgs.count("-onion")?mapArgs["-onion"]:mapArgs["-tor"])); return InitError(strprintf(_("Invalid -onion address: '%s'"), mapArgs["-onion"]));
SetProxy(NET_TOR, addrOnion, 5); SetProxy(NET_TOR, addrOnion, 5);
SetReachable(NET_TOR); SetReachable(NET_TOR);
} }