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 bool GetfLargeWorkInvalidChainFound()
43 return fLargeWorkInvalidChainFound
;
46 std::string
GetWarnings(const std::string
& strFor
)
48 std::string strStatusBar
;
51 const std::string uiAlertSeperator
= "<hr />";
55 if (!CLIENT_VERSION_IS_RELEASE
) {
56 strStatusBar
= "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications";
57 strGUI
= _("This is a pre-release test build - use at your own risk - do not use for mining or merchant applications");
60 if (GetBoolArg("-testsafemode", DEFAULT_TESTSAFEMODE
))
61 strStatusBar
= strRPC
= strGUI
= "testsafemode enabled";
63 // Misc warnings like out of disk space and clock is wrong
64 if (strMiscWarning
!= "")
66 strStatusBar
= strMiscWarning
;
67 strGUI
+= (strGUI
.empty() ? "" : uiAlertSeperator
) + strMiscWarning
;
70 if (fLargeWorkForkFound
)
72 strStatusBar
= strRPC
= "Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.";
73 strGUI
+= (strGUI
.empty() ? "" : uiAlertSeperator
) + _("Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.");
75 else if (fLargeWorkInvalidChainFound
)
77 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.";
78 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.");
83 else if (strFor
== "statusbar")
85 else if (strFor
== "rpc")
87 assert(!"GetWarnings(): invalid parameter");