Remove alerts

This commit is contained in:
Duke
2022-12-18 08:24:49 -08:00
parent 4257b257df
commit ae64eb2392
14 changed files with 9 additions and 502 deletions

View File

@@ -20,7 +20,6 @@
#include "main.h"
#include "sodium.h"
#include "addrman.h"
#include "alert.h"
#include "arith_uint256.h"
#include "importcoin.h"
#include "chainparams.h"
@@ -106,7 +105,6 @@ bool fCheckpointsEnabled = true;
bool fCoinbaseEnforcedProtectionEnabled = true;
size_t nCoinCacheUsage = 5000 * 300;
uint64_t nPruneTarget = 0;
bool fAlerts = DEFAULT_ALERTS;
// If the tip is older than this (in seconds), the node is considered to be in initial block download.
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE;
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
@@ -2470,9 +2468,9 @@ void CheckForkWarningConditions()
{
if (!fLargeWorkForkFound && pindexBestForkBase)
{
std::string warning = std::string("'Warning: Large-work fork detected, forking after block ") +
pindexBestForkBase->phashBlock->ToString() + std::string("'");
CAlert::Notify(warning, true);
std::string warning = std::string("'Warning: Large-work fork detected, forking after block ") + pindexBestForkBase->phashBlock->ToString() + std::string("'");
LogPrintf(warning);
LogPrintf("%s: %s\n", __func__, warning.c_str());
}
if (pindexBestForkTip && pindexBestForkBase)
{
@@ -2480,12 +2478,9 @@ void CheckForkWarningConditions()
pindexBestForkBase->GetHeight(), pindexBestForkBase->phashBlock->ToString(),
pindexBestForkTip->GetHeight(), pindexBestForkTip->phashBlock->ToString());
fLargeWorkForkFound = true;
}
else
{
} else {
std::string warning = std::string("Warning: Found invalid chain at least ~6 blocks longer than our best chain.\nChain state database corruption likely.");
LogPrintf("%s: %s\n", warning.c_str(), __func__);
CAlert::Notify(warning, true);
LogPrintf("%s: %s\n", __func__, warning.c_str());
fLargeWorkInvalidChainFound = true;
}
} else {
@@ -6651,11 +6646,7 @@ void static CheckBlockIndex()
assert(nNodes == forward.size());
}
//////////////////////////////////////////////////////////////////////////////
//
// CAlert
//
std::string GetWarnings(const std::string& strFor)
{
int nPriority = 0;
@@ -6686,23 +6677,6 @@ std::string GetWarnings(const std::string& strFor)
strStatusBar = strRPC = _("Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade.");
}
// Alerts
{
LOCK(cs_mapAlerts);
BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts)
{
const CAlert& alert = item.second;
if (alert.AppliesToMe() && alert.nPriority > nPriority)
{
nPriority = alert.nPriority;
strStatusBar = alert.strStatusBar;
if (alert.nPriority >= ALERT_PRIORITY_SAFE_MODE) {
strRPC = alert.strRPCError;
}
}
}
}
if (strFor == "statusbar")
return strStatusBar;
else if (strFor == "rpc")
@@ -6711,18 +6685,7 @@ std::string GetWarnings(const std::string& strFor)
return "error";
}
//////////////////////////////////////////////////////////////////////////////
//
// Messages
//
bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
{
@@ -7702,9 +7665,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
if (vInv.size() > 0)
pfrom->PushMessage("inv", vInv);
} else if (fAlerts && strCommand == "alert") {
// Do not process alert p2p messages and give DoS penalty
Misbehaving(pfrom->GetId(), 10);
} else if (strCommand == "alert") {
// Do not process alert p2p messages
// Misbehaving(pfrom->GetId(), 10);
} else if (!(nLocalServices & NODE_BLOOM) &&
(strCommand == "filterload" ||
strCommand == "filteradd")) {