aboutsummaryrefslogtreecommitdiff
path: root/src/warnings.cpp
diff options
context:
space:
mode:
authorRoss Nicoll <[email protected]>2018-04-22 17:19:03 +0100
committerRoss Nicoll <[email protected]>2018-09-19 22:11:47 +0100
commit41c868f47e671dc5009cd47496c39c13ae36306b (patch)
treee48b4f07bce4ff5aac8369551032dc46c46a8bf1 /src/warnings.cpp
parentUpdate or eliminate remaining tests (#1483) (diff)
downloaddiscoin-41c868f47e671dc5009cd47496c39c13ae36306b.tar.xz
discoin-41c868f47e671dc5009cd47496c39c13ae36306b.zip
Re-introduce alert functionality (#1470)
Re-introduce alert functionality removed from Bitcoin upstream
Diffstat (limited to 'src/warnings.cpp')
-rw-r--r--src/warnings.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/warnings.cpp b/src/warnings.cpp
index 2c1b1b0e1..f3d87c510 100644
--- a/src/warnings.cpp
+++ b/src/warnings.cpp
@@ -3,11 +3,16 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include "alert.h"
#include "sync.h"
#include "clientversion.h"
+#include "uint256.h"
#include "util.h"
+#include "utilstrencodings.h"
#include "warnings.h"
+#include <boost/foreach.hpp>
+
CCriticalSection cs_warnings;
std::string strMiscWarning;
bool fLargeWorkForkFound = false;
@@ -45,6 +50,7 @@ bool GetfLargeWorkInvalidChainFound()
std::string GetWarnings(const std::string& strFor)
{
+ int nPriority = 0;
std::string strStatusBar;
std::string strRPC;
std::string strGUI;
@@ -63,21 +69,38 @@ std::string GetWarnings(const std::string& strFor)
// Misc warnings like out of disk space and clock is wrong
if (strMiscWarning != "")
{
+ nPriority = 1000;
strStatusBar = strMiscWarning;
strGUI += (strGUI.empty() ? "" : uiAlertSeperator) + strMiscWarning;
}
if (fLargeWorkForkFound)
{
+ nPriority = 2000;
strStatusBar = strRPC = "Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.";
strGUI += (strGUI.empty() ? "" : uiAlertSeperator) + _("Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.");
}
else if (fLargeWorkInvalidChainFound)
{
+ nPriority = 2000;
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.";
strGUI += (strGUI.empty() ? "" : uiAlertSeperator) + _("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 = strGUI = alert.strStatusBar;
+ }
+ }
+ }
+
if (strFor == "gui")
return strGUI;
else if (strFor == "statusbar")