Check pindexBestForkBase/phashBlock both for null

This commit is contained in:
Evan Duffield 2015-01-23 11:29:29 -07:00
parent 3b140b22d7
commit 90ad641d39
3 changed files with 11 additions and 9 deletions

View File

@ -3,7 +3,7 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 11) define(_CLIENT_VERSION_MINOR, 11)
define(_CLIENT_VERSION_REVISION, 0) define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 12) define(_CLIENT_VERSION_BUILD, 13)
define(_CLIENT_VERSION_IS_RELEASE, true) define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2015) define(_COPYRIGHT_YEAR, 2015)
AC_INIT([Darkcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@darkcoin.io],[darkcoin]) AC_INIT([Darkcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@darkcoin.io],[darkcoin])

View File

@ -12,7 +12,7 @@
#define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 11 #define CLIENT_VERSION_MINOR 11
#define CLIENT_VERSION_REVISION 0 #define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 12 #define CLIENT_VERSION_BUILD 13

View File

@ -1743,20 +1743,22 @@ void CheckForkWarningConditions()
if (pindexBestForkTip || (pindexBestInvalid && pindexBestInvalid->nChainWork > chainActive.Tip()->nChainWork + (chainActive.Tip()->GetBlockWork() * 6).getuint256())) if (pindexBestForkTip || (pindexBestInvalid && pindexBestInvalid->nChainWork > chainActive.Tip()->nChainWork + (chainActive.Tip()->GetBlockWork() * 6).getuint256()))
{ {
if (!fLargeWorkForkFound) if (!fLargeWorkForkFound && pindexBestForkBase)
{ {
if(pindexBestForkBase->phashBlock != NULL){ if(pindexBestForkBase->phashBlock){
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", if(pindexBestForkBase->phashBlock){
pindexBestForkBase->nHeight, pindexBestForkBase->phashBlock->ToString(), 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",
pindexBestForkTip->nHeight, pindexBestForkTip->phashBlock->ToString()); pindexBestForkBase->nHeight, pindexBestForkBase->phashBlock->ToString(),
fLargeWorkForkFound = true; pindexBestForkTip->nHeight, pindexBestForkTip->phashBlock->ToString());
fLargeWorkForkFound = true;
}
} }
else else
{ {