Major updates integration from all upstreams
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "deprecation.h"
|
||||
|
||||
#include "alert.h"
|
||||
#include "clientversion.h"
|
||||
#include "init.h"
|
||||
#include "ui_interface.h"
|
||||
@@ -13,14 +14,15 @@
|
||||
static const std::string CLIENT_VERSION_STR = FormatVersion(CLIENT_VERSION);
|
||||
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
||||
|
||||
void EnforceNodeDeprecation(int nHeight, bool forceLogging) {
|
||||
void EnforceNodeDeprecation(int nHeight, bool forceLogging, bool fThread) {
|
||||
|
||||
// Do not enforce deprecation in regtest or on testnet
|
||||
std::string networkID = Params().NetworkIDString();
|
||||
std::string msg;
|
||||
|
||||
if (networkID != "main" || ASSETCHAINS_SYMBOL[0] != 0 ) 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:
|
||||
@@ -29,34 +31,20 @@ void EnforceNodeDeprecation(int nHeight, bool forceLogging) {
|
||||
// occurs, but that's an irregular event that won't cause spam.
|
||||
// - The node is starting
|
||||
if (blocksToDeprecation == 0 || forceLogging) {
|
||||
auto msg = strprintf(_("This version has been deprecated as of block height %d."),
|
||||
msg = strprintf(_("This version has been deprecated as of block height %d."),
|
||||
DEPRECATION_HEIGHT) + " " +
|
||||
_("You should upgrade to the latest version of Komodo.");
|
||||
if (!disableDeprecation) {
|
||||
msg += " " + strprintf(_("To disable deprecation for this version, set %s%s."),
|
||||
"-disabledeprecation=", CLIENT_VERSION_STR);
|
||||
}
|
||||
LogPrintf("*** %s\n", msg);
|
||||
CAlert::Notify(msg, fThread);
|
||||
uiInterface.ThreadSafeMessageBox(msg, "", CClientUIInterface::MSG_ERROR);
|
||||
}
|
||||
if (!disableDeprecation) {
|
||||
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."),
|
||||
StartShutdown();
|
||||
} else if (blocksToDeprecation == DEPRECATION_WARN_LIMIT || (blocksToDeprecation < DEPRECATION_WARN_LIMIT && forceLogging)) {
|
||||
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 Komodo.");
|
||||
} 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 Komodo.") + " " +
|
||||
strprintf(_("To disable deprecation for this version, set %s%s."),
|
||||
"-disabledeprecation=", CLIENT_VERSION_STR);
|
||||
}
|
||||
LogPrintf("*** %s\n", msg);
|
||||
uiInterface.ThreadSafeMessageBox(msg, "", CClientUIInterface::MSG_WARNING);
|
||||
}
|
||||
LogPrintf("*** %s\n", msg);
|
||||
CAlert::Notify(msg, fThread);
|
||||
uiInterface.ThreadSafeMessageBox(msg, "", CClientUIInterface::MSG_WARNING);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user