1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2016 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
7 #include "clientversion.h"
11 CCriticalSection cs_warnings
;
12 std::string strMiscWarning
;
13 bool fLargeWorkForkFound
= false;
14 bool fLargeWorkInvalidChainFound
= false;
16 void SetMiscWarning(const std::string
& strWarning
)
19 strMiscWarning
= strWarning
;
22 void SetfLargeWorkForkFound(bool flag
)
25 fLargeWorkForkFound
= flag
;
28 bool GetfLargeWorkForkFound()
31 return fLargeWorkForkFound
;
34 void SetfLargeWorkInvalidChainFound(bool flag
)
37 fLargeWorkInvalidChainFound
= flag
;
40 std::string
GetWarnings(const std::string
& strFor
)
42 std::string strStatusBar
;
45 const std::string uiAlertSeperator
= "<hr />";
49 if (!CLIENT_VERSION_IS_RELEASE
) {
50 strStatusBar
= "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications";
51 strGUI
= _("This is a pre-release test build - use at your own risk - do not use for mining or merchant applications");
54 if (gArgs
.GetBoolArg("-testsafemode", DEFAULT_TESTSAFEMODE
))
55 strStatusBar
= strRPC
= strGUI
= "testsafemode enabled";
57 // Misc warnings like out of disk space and clock is wrong
58 if (strMiscWarning
!= "")
60 strStatusBar
= strMiscWarning
;
61 strGUI
+= (strGUI
.empty() ? "" : uiAlertSeperator
) + strMiscWarning
;
64 if (fLargeWorkForkFound
)
66 strStatusBar
= strRPC
= "Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.";
67 strGUI
+= (strGUI
.empty() ? "" : uiAlertSeperator
) + _("Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.");
69 else if (fLargeWorkInvalidChainFound
)
71 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.";
72 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.");
77 else if (strFor
== "statusbar")
79 else if (strFor
== "rpc")
81 assert(!"GetWarnings(): invalid parameter");