Reenable checkpoints for IsInSync()

This commit is contained in:
miketout
2018-08-27 18:26:22 -07:00
parent 64d6048f4a
commit 1b7e60f7f6

View File

@@ -1936,7 +1936,6 @@ bool IsInitialBlockDownload()
bool IsInSync() bool IsInSync()
{ {
const CChainParams& chainParams = Params(); const CChainParams& chainParams = Params();
CBlockIndex *pbi;
LOCK(cs_main); LOCK(cs_main);
if (fImporting || fReindex) if (fImporting || fReindex)
@@ -1946,20 +1945,23 @@ bool IsInSync()
} }
if (fCheckpointsEnabled) if (fCheckpointsEnabled)
{ {
pbi = Checkpoints::GetLastCheckpoint(chainParams.Checkpoints()); if (fCheckpointsEnabled && chainActive.Height() < Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints()))
if (fCheckpointsEnabled && pbi && (chainActive.Height() < pbi->nHeight))
{ {
//fprintf(stderr,"IsInSync: checkpoint -> initialdownload chainActive.Height().%d pbi->nHeight.%d\n", chainActive.Height(), pbi->nHeight); //fprintf(stderr,"IsInSync: checkpoint -> initialdownload chainActive.Height().%d GetTotalBlocksEstimate(chainParams.Checkpoints().%d\n", chainActive.Height(), Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints()));
return false; return false;
} }
} }
pbi = chainActive.Tip();
CBlockIndex *pbi = chainActive.Tip();
int longestchain = komodo_longestchain();
if ( !pbi || if ( !pbi ||
(pindexBestHeader == 0) || (pindexBestHeader == 0) ||
((pindexBestHeader->nHeight - 1) > pbi->nHeight) || ((pindexBestHeader->nHeight - 1) > pbi->nHeight) ||
(komodo_longestchain() != 0 && komodo_longestchain() > pbi->nHeight) ) (longestchain != 0 && longestchain > pbi->nHeight) )
return false; return false;
//printf("IsInSync: checkpoint -> initialdownload chainActive.Height().%d longestchain.%d\n", chainActive.Height(), longestchain);
return true; return true;
} }