aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2013-05-18 03:09:28 +0200
committerMatt Corallo <git@bluematt.me>2013-07-22 12:12:45 +0200
commitf65e7092a200ee6e9453058c3dafbab62d9b4dcc (patch)
tree85980349580b4383572af029244c83a91a86b1db /src
parentf89faa258404d2e6fd4300990275cd2439e51255 (diff)
Better warning/"alert" messages for large-work forks.
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp31
1 files changed, 26 insertions, 5 deletions
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