Merge pull request #5154

730b1ed Check pindexBestForkBase for null (21E14)
This commit is contained in:
Wladimir J. van der Laan 2014-11-24 15:28:57 +01:00
commit 1ee685f984
No known key found for this signature in database
GPG key ID: 74810B012346C9A6

View file

@ -1228,13 +1228,13 @@ void CheckForkWarningConditions()
if (pindexBestForkTip || (pindexBestInvalid && pindexBestInvalid->nChainWork > chainActive.Tip()->nChainWork + (GetBlockProof(*chainActive.Tip()) * 6))) if (pindexBestForkTip || (pindexBestInvalid && pindexBestInvalid->nChainWork > chainActive.Tip()->nChainWork + (GetBlockProof(*chainActive.Tip()) * 6)))
{ {
if (!fLargeWorkForkFound) if (!fLargeWorkForkFound && pindexBestForkBase)
{ {
std::string warning = std::string("'Warning: Large-work fork detected, forking after block ") + std::string warning = std::string("'Warning: Large-work fork detected, forking after block ") +
pindexBestForkBase->phashBlock->ToString() + std::string("'"); pindexBestForkBase->phashBlock->ToString() + std::string("'");
CAlert::Notify(warning, true); CAlert::Notify(warning, true);
} }
if (pindexBestForkTip) if (pindexBestForkTip && pindexBestForkBase)
{ {
LogPrintf("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", LogPrintf("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(), pindexBestForkBase->nHeight, pindexBestForkBase->phashBlock->ToString(),