Skip to content

Commit 7209fec

Browse files
committed
Merge #13532: Log warning when deprecated network name 'tor' is used
9f8c54b Log warning message when deprecated network name 'tor' is used (e.g. option onlynet=tor) (wodry) Pull request description: As @laanwj mentioned [here](bitcoin/bitcoin#13418 (comment)), 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
2 parents 2643fa5 + 9f8c54b commit 7209fec

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/netbase.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ enum Network ParseNetwork(std::string net) {
4141
boost::to_lower(net);
4242
if (net == "ipv4") return NET_IPV4;
4343
if (net == "ipv6") return NET_IPV6;
44-
if (net == "tor" || net == "onion") return NET_TOR;
44+
if (net == "onion") return NET_TOR;
45+
if (net == "tor") {
46+
LogPrintf("Warning: net name 'tor' is deprecated and will be removed in the future. You should use 'onion' instead.\n");
47+
return NET_TOR;
48+
}
4549
return NET_UNROUTABLE;
4650
}
4751

0 commit comments

Comments
 (0)