Auto merge of #3137 - str4d:2943-remove-auto-senescence-option, r=ebfull

Remove config option -disabledeprecation

Closes #2943.
This commit is contained in:
Homu
2018-06-12 08:51:13 -07:00
5 changed files with 26 additions and 41 deletions

View File

@@ -4,3 +4,23 @@ release-notes at release time)
Notable changes
===============
`-disabledeprecation` removal
-----------------------------
In release 1.0.9 we implemented automatic deprecation of `zcashd` software
versions made by the Zcash Company. The configuration option
`-disabledeprecation` was added as a way for users to specifically choose to
stay on a particular software version. However, it incorrectly implied that
deprecated releases would still be supported.
This release removes the `-disabledeprecation` option, so that `zcashd` software
versions made by the Zcash Company will always shut down in accordance with the
defined deprecation policy (currently 16 weeks after release). Users who wish to
use a different policy must now specifically choose to either:
- edit and compile the source code themselves, or
- obtain a software version from someone else who has done so (and obtain
support from them).
Either way, it is much clearer that the software they are running is not
supported by the Zcash Company.

View File

@@ -20,7 +20,6 @@ void EnforceNodeDeprecation(int nHeight, bool forceLogging, bool fThread) {
if (networkID != "main") return;
int blocksToDeprecation = DEPRECATION_HEIGHT - nHeight;
bool disableDeprecation = (GetArg("-disabledeprecation", "") == CLIENT_VERSION_STR);
if (blocksToDeprecation <= 0) {
// In order to ensure we only log once per process when deprecation is
// disabled (to avoid log spam), we only need to log in two cases:
@@ -32,31 +31,16 @@ void EnforceNodeDeprecation(int nHeight, bool forceLogging, bool fThread) {
auto msg = strprintf(_("This version has been deprecated as of block height %d."),
DEPRECATION_HEIGHT) + " " +
_("You should upgrade to the latest version of Zcash.");
if (!disableDeprecation) {
msg += " " + strprintf(_("To disable deprecation for this version, set '%s' to '%s'."),
"disabledeprecation", CLIENT_VERSION_STR);
}
LogPrintf("*** %s\n", msg);
CAlert::Notify(msg, fThread);
uiInterface.ThreadSafeMessageBox(msg, "", CClientUIInterface::MSG_ERROR);
}
if (!disableDeprecation) {
StartShutdown();
}
StartShutdown();
} else if (blocksToDeprecation == DEPRECATION_WARN_LIMIT ||
(blocksToDeprecation < DEPRECATION_WARN_LIMIT && forceLogging)) {
std::string msg;
if (disableDeprecation) {
msg = strprintf(_("This version will be deprecated at block height %d."),
std::string msg = strprintf(_("This version will be deprecated at block height %d, and will automatically shut down."),
DEPRECATION_HEIGHT) + " " +
_("You should upgrade to the latest version of Zcash.");
} else {
msg = strprintf(_("This version will be deprecated at block height %d, and will automatically shut down."),
DEPRECATION_HEIGHT) + " " +
_("You should upgrade to the latest version of Zcash.") + " " +
strprintf(_("To disable deprecation for this version, set '%s' to '%s'."),
"disabledeprecation", CLIENT_VERSION_STR);
}
LogPrintf("*** %s\n", msg);
CAlert::Notify(msg, fThread);
uiInterface.ThreadSafeMessageBox(msg, "", CClientUIInterface::MSG_WARNING);

View File

@@ -107,22 +107,6 @@ TEST_F(DeprecationTest, DeprecatedNodeErrorIsRepeatedOnStartup) {
EXPECT_TRUE(ShutdownRequested());
}
TEST_F(DeprecationTest, DeprecatedNodeShutsDownIfOldVersionDisabled) {
EXPECT_FALSE(ShutdownRequested());
mapArgs["-disabledeprecation"] = "1.0.0";
EXPECT_CALL(mock_, ThreadSafeMessageBox(::testing::_, "", CClientUIInterface::MSG_ERROR));
EnforceNodeDeprecation(DEPRECATION_HEIGHT);
EXPECT_TRUE(ShutdownRequested());
}
TEST_F(DeprecationTest, DeprecatedNodeKeepsRunningIfCurrentVersionDisabled) {
EXPECT_FALSE(ShutdownRequested());
mapArgs["-disabledeprecation"] = CLIENT_VERSION_STR;
EXPECT_CALL(mock_, ThreadSafeMessageBox(::testing::_, "", CClientUIInterface::MSG_ERROR));
EnforceNodeDeprecation(DEPRECATION_HEIGHT);
EXPECT_FALSE(ShutdownRequested());
}
TEST_F(DeprecationTest, DeprecatedNodeIgnoredOnRegtest) {
SelectParams(CBaseChainParams::REGTEST);
EXPECT_FALSE(ShutdownRequested());
@@ -150,10 +134,9 @@ TEST_F(DeprecationTest, AlertNotify) {
EXPECT_EQ(r.size(), 1u);
// -alertnotify restricts the message to safe characters.
auto expectedMsg = SanitizeString(strprintf(
"This version will be deprecated at block height %d, and will automatically shut down. You should upgrade to the latest version of Zcash. To disable deprecation for this version, set disabledeprecation to %s.",
DEPRECATION_HEIGHT,
CLIENT_VERSION_STR));
auto expectedMsg = strprintf(
"This version will be deprecated at block height %d, and will automatically shut down. You should upgrade to the latest version of Zcash.",
DEPRECATION_HEIGHT);
// Windows built-in echo semantics are different than posixy shells. Quotes and
// whitespace are printed literally.

View File

@@ -351,8 +351,6 @@ std::string HelpMessage(HelpMessageMode mode)
#endif
}
strUsage += HelpMessageOpt("-datadir=<dir>", _("Specify data directory"));
strUsage += HelpMessageOpt("-disabledeprecation=<version>", strprintf(_("Disable block-height node deprecation and automatic shutdown (example: -disabledeprecation=%s)"),
FormatVersion(CLIENT_VERSION)));
strUsage += HelpMessageOpt("-exportdir=<dir>", _("Specify directory to be used when exporting data"));
strUsage += HelpMessageOpt("-dbcache=<n>", strprintf(_("Set database cache size in megabytes (%d to %d, default: %d)"), nMinDbCache, nMaxDbCache, nDefaultDbCache));
strUsage += HelpMessageOpt("-loadblock=<file>", _("Imports blocks from external blk000??.dat file") + " " + _("on startup"));

View File

@@ -410,7 +410,7 @@ UniValue getdeprecationinfo(const UniValue& params, bool fHelp)
"{\n"
" \"version\": xxxxx, (numeric) the server version\n"
" \"subversion\": \"/MagicBean:x.y.z[-v]/\", (string) the server subversion string\n"
" \"deprecationheight\": xxxxx, (numeric) the block height at which this version will deprecate and shut down (unless -disabledeprecation is set)\n"
" \"deprecationheight\": xxxxx, (numeric) the block height at which this version will deprecate and shut down\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("getdeprecationinfo", "")