From 6087f72d159ff842a5ddc52ad691fd496e3468c2 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 27 Jun 2018 07:42:30 +0200 Subject: [PATCH] Merge #13532: Log warning when deprecated network name 'tor' is used 9f8c54b1b5ddedddf47fc51c1fcb533321f6f89f Log warning message when deprecated network name 'tor' is used (e.g. option onlynet=tor) (wodry) Pull request description: As @laanwj mentioned [here](https://github.com/bitcoin/bitcoin/pull/13418#discussion_r197645385), using option `onlynet=tor` is deprecated. I think it would be good to give the user a depcreaction warning feedback, so users can switch to `onlynet=onion` so there is a perspective for removing the deprecated `tor` in the future to decrease confusion. Currently, users maybe just wonder that they can use a undocumented option, or they are not aware that they use a deprecated option. Alternatively for the log warning message, I think at least this deprecetaion should be documented in the source code in a comment for readers of the source code. Tree-SHA512: f4889793cdd62a0a13353e13994ed50ca7d367fa9da9897ce909f86cf0b0ce6151b3c484c8e514b8ac332949c6bbc71001e06e918248a1089f73756bd4840602 --- src/netbase.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/netbase.cpp b/src/netbase.cpp index de9fcf000c069..eb47c67abc27b 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -44,7 +44,11 @@ enum Network ParseNetwork(std::string net) { boost::to_lower(net); if (net == "ipv4") return NET_IPV4; if (net == "ipv6") return NET_IPV6; - if (net == "tor" || net == "onion") return NET_TOR; + if (net == "onion") return NET_TOR; + if (net == "tor") { + LogPrintf("Warning: net name 'tor' is deprecated and will be removed in the future. You should use 'onion' instead.\n"); + return NET_TOR; + } return NET_UNROUTABLE; }