| 6090 | // |
| 6091 | |
| 6092 | string GetWarnings(string strFor) |
| 6093 | { |
| 6094 | int nPriority = 0; |
| 6095 | string strStatusBar; |
| 6096 | string strRPC; |
| 6097 | |
| 6098 | if (!CLIENT_VERSION_IS_RELEASE) |
| 6099 | strStatusBar = _("This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"); |
| 6100 | |
| 6101 | if (GetBoolArg("-testsafemode", false)) |
| 6102 | strStatusBar = strRPC = "testsafemode enabled"; |
| 6103 | |
| 6104 | // Misc warnings like out of disk space and clock is wrong |
| 6105 | if (strMiscWarning != "") { |
| 6106 | nPriority = 1000; |
| 6107 | strStatusBar = strMiscWarning; |
| 6108 | } |
| 6109 | |
| 6110 | if (fLargeWorkForkFound) { |
| 6111 | nPriority = 2000; |
| 6112 | strStatusBar = strRPC = _("Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues."); |
| 6113 | } else if (fLargeWorkInvalidChainFound) { |
| 6114 | nPriority = 2000; |
| 6115 | 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."); |
| 6116 | } |
| 6117 | |
| 6118 | // Alerts |
| 6119 | { |
| 6120 | LOCK(cs_mapAlerts); |
| 6121 | for (PAIRTYPE(const uint256, CAlert) & item : mapAlerts) { |
| 6122 | const CAlert& alert = item.second; |
| 6123 | if (alert.AppliesToMe() && alert.nPriority > nPriority) { |
| 6124 | nPriority = alert.nPriority; |
| 6125 | strStatusBar = alert.strStatusBar; |
| 6126 | } |
| 6127 | } |
| 6128 | } |
| 6129 | |
| 6130 | if (strFor == "statusbar") |
| 6131 | return strStatusBar; |
| 6132 | else if (strFor == "rpc") |
| 6133 | return strRPC; |
| 6134 | assert(!"GetWarnings() : invalid parameter"); |
| 6135 | return "error"; |
| 6136 | } |
| 6137 | |
| 6138 | |
| 6139 | ////////////////////////////////////////////////////////////////////////////// |
| 6140 | // |
| 6141 | // Messages |
| 6142 | // |
| 6143 | |
| 6144 | |
| 6145 | bool static AlreadyHave(const CInv& inv) |
| 6146 | { |
| 6147 | switch (inv.type) { |
| 6148 | case MSG_TX: |
| 6149 | case MSG_WITNESS_TX: |
no test coverage detected