| 2563 | // |
| 2564 | |
| 2565 | string GetWarnings(string strFor) { |
| 2566 | int32_t nPriority = 0; |
| 2567 | string strStatusBar; |
| 2568 | string strRPC; |
| 2569 | |
| 2570 | if (SysCfg().GetBoolArg("-testsafemode", false)) |
| 2571 | strRPC = "test"; |
| 2572 | |
| 2573 | if (!CLIENT_VERSION_IS_RELEASE) |
| 2574 | strStatusBar = _("This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"); |
| 2575 | |
| 2576 | // Misc warnings like out of disk space and clock is wrong |
| 2577 | if (strMiscWarning != "") { |
| 2578 | nPriority = 1000; |
| 2579 | strStatusBar = strMiscWarning; |
| 2580 | } |
| 2581 | |
| 2582 | if (fLargeWorkForkFound) { |
| 2583 | nPriority = 2000; |
| 2584 | strStatusBar = strRPC = _("Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues."); |
| 2585 | } else if (fLargeWorkInvalidChainFound) { |
| 2586 | nPriority = 2000; |
| 2587 | 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."); |
| 2588 | } |
| 2589 | |
| 2590 | // Alerts |
| 2591 | { |
| 2592 | LOCK(cs_mapAlerts); |
| 2593 | for (auto &item : mapAlerts) { |
| 2594 | const CAlert &alert = item.second; |
| 2595 | if (alert.AppliesToMe() && alert.nPriority > nPriority) { |
| 2596 | nPriority = alert.nPriority; |
| 2597 | strStatusBar = alert.strStatusBar; |
| 2598 | } |
| 2599 | } |
| 2600 | } |
| 2601 | |
| 2602 | if (strFor == "statusbar") |
| 2603 | return strStatusBar; |
| 2604 | else if (strFor == "rpc") |
| 2605 | return strRPC; |
| 2606 | assert(!"GetWarnings() : invalid parameter"); |
| 2607 | return "error"; |
| 2608 | } |
| 2609 | |
| 2610 | |
| 2611 | class CMainCleanup { |
no test coverage detected