diff --git a/src/deprecation.cpp b/src/deprecation.cpp index 4c197cce1..5dec87d91 100644 --- a/src/deprecation.cpp +++ b/src/deprecation.cpp @@ -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); diff --git a/src/gtest/test_deprecation.cpp b/src/gtest/test_deprecation.cpp index bdb52f05a..a6ff40f70 100644 --- a/src/gtest/test_deprecation.cpp +++ b/src/gtest/test_deprecation.cpp @@ -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. diff --git a/src/init.cpp b/src/init.cpp index 2962f3b9a..25f913de8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -351,8 +351,6 @@ std::string HelpMessage(HelpMessageMode mode) #endif } strUsage += HelpMessageOpt("-datadir=", _("Specify data directory")); - strUsage += HelpMessageOpt("-disabledeprecation=", strprintf(_("Disable block-height node deprecation and automatic shutdown (example: -disabledeprecation=%s)"), - FormatVersion(CLIENT_VERSION))); strUsage += HelpMessageOpt("-exportdir=", _("Specify directory to be used when exporting data")); strUsage += HelpMessageOpt("-dbcache=", strprintf(_("Set database cache size in megabytes (%d to %d, default: %d)"), nMinDbCache, nMaxDbCache, nDefaultDbCache)); strUsage += HelpMessageOpt("-loadblock=", _("Imports blocks from external blk000??.dat file") + " " + _("on startup")); diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index 0337e097b..d49ea527a 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -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", "")