diff --git a/src/main.cpp b/src/main.cpp index b206b68036..7dc51fc9dc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1384,6 +1384,7 @@ bool IsInitialBlockDownload() } bool fLargeWorkForkFound = false; +bool fLargeWorkInvalidChainFound = false; CBlockIndex *pindexBestForkTip = NULL, *pindexBestForkBase = NULL; void CheckForkWarningConditions() @@ -1400,15 +1401,30 @@ void CheckForkWarningConditions() std::string strCmd = GetArg("-alertnotify", ""); if (!strCmd.empty()) { - std::string warning("'Warning: Large-work fork detected. You may need to upgrade, or other nodes may need to upgrade.'"); + std::string warning = std::string("'Warning: Large-work fork detected, forking after block ") + + pindexBestForkBase->phashBlock->ToString() + std::string("'"); boost::replace_all(strCmd, "%s", warning); boost::thread t(runCommand, strCmd); // thread runs free } } - fLargeWorkForkFound = true; - printf("CheckForkWarningConditions: Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.\n"); - } else + if (pindexBestForkTip) + { + printf("CheckForkWarningConditions: Warning: Large valid fork found\n forking the chain at height %d (%s)\n lasting to height %d (%s).\nChain state database corruption likely.\n", + pindexBestForkBase->nHeight, pindexBestForkBase->phashBlock->ToString().c_str(), + pindexBestForkTip->nHeight, pindexBestForkTip->phashBlock->ToString().c_str()); + fLargeWorkForkFound = true; + } + else + { + printf("CheckForkWarningConditions: Warning: Found invalid chain at least ~6 blocks longer than our best chain.\nChain state database corruption likely.\n"); + fLargeWorkInvalidChainFound = true; + } + } + else + { fLargeWorkForkFound = false; + fLargeWorkInvalidChainFound = false; + } } void CheckForkWarningConditionsOnNewFork(CBlockIndex* pindexNewForkTip) @@ -3138,7 +3154,12 @@ string GetWarnings(string strFor) if (fLargeWorkForkFound) { nPriority = 2000; - strStatusBar = strRPC = _("Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade."); + strStatusBar = strRPC = _("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."); } // Alerts