Enable syncing of new test chains before checkpoints have started

This commit is contained in:
miketout
2018-08-25 10:48:40 -07:00
parent 46d858beca
commit 6d84700d44
4 changed files with 16 additions and 8 deletions

View File

@@ -760,7 +760,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim
{ {
fprintf(stderr,"checkdeposit: ht.%d checktoshis %.8f overflow.%d total %.8f strangeout.%d\n",height,dstr(checktoshis),overflow,dstr(total),strangeout); fprintf(stderr,"checkdeposit: ht.%d checktoshis %.8f overflow.%d total %.8f strangeout.%d\n",height,dstr(checktoshis),overflow,dstr(total),strangeout);
if ( strangeout != 0 ) if ( strangeout != 0 )
fprintf(stderr,">>>>>>>>>>>>> %s DUST ht.%d strangout.%d notmatched.%d <<<<<<<<<\n",ASSETCHAINS_SYMBOL,height,strangeout,notmatched); fprintf(stderr,">>>>>>>>>>>>> %s DUST ht.%d strangeout.%d notmatched.%d <<<<<<<<<\n",ASSETCHAINS_SYMBOL,height,strangeout,notmatched);
return(-1); return(-1);
} }
} }

View File

@@ -1936,21 +1936,27 @@ 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)
{ {
//fprintf(stderr,"IsInitialBlockDownload: fImporting %d || %d fReindex\n",(int32_t)fImporting,(int32_t)fReindex); //fprintf(stderr,"IsInitialBlockDownload: fImporting %d || %d fReindex\n",(int32_t)fImporting,(int32_t)fReindex);
return false; return false;
} }
if (fCheckpointsEnabled && chainActive.Height() < Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints())) if (fCheckpointsEnabled)
{ {
//fprintf(stderr,"IsInitialBlockDownload: checkpoint -> initialdownload\n"); pbi = Checkpoints::GetLastCheckpoint(chainParams.Checkpoints());
return false; if (fCheckpointsEnabled && pbi && (chainActive.Height() < pbi->nHeight))
{
//fprintf(stderr,"IsInitialBlockDownload: checkpoint -> initialdownload\n");
return false;
}
} }
CBlockIndex *ptr = chainActive.Tip(); pbi = chainActive.Tip();
if ( !ptr ) if ( !pbi )
return false; return false;
else if ( pindexBestHeader != 0 && (pindexBestHeader->nHeight - 1) > ptr->nHeight ) else if ( pindexBestHeader != 0 && ((pindexBestHeader->nHeight - 1) > pbi->nHeight) )
return false; return false;
return true; return true;

View File

@@ -796,7 +796,7 @@ int32_t waitForPeers(const CChainParams &chainparams)
LOCK(cs_vNodes); LOCK(cs_vNodes);
fvNodesEmpty = vNodes.empty(); fvNodesEmpty = vNodes.empty();
} }
if (!IsInSync() || fvNodesEmpty) if (fvNodesEmpty || !IsInSync())
{ {
do { do {
MilliSleep(100 + rand() % 400); MilliSleep(100 + rand() % 400);

View File

@@ -2346,6 +2346,8 @@ std::vector<uint256> CWallet::ResendWalletTransactionsBefore(int64_t nTime)
if ( wtx.nLockTime >= LOCKTIME_THRESHOLD && wtx.nLockTime < now-KOMODO_MAXMEMPOOLTIME ) if ( wtx.nLockTime >= LOCKTIME_THRESHOLD && wtx.nLockTime < now-KOMODO_MAXMEMPOOLTIME )
{ {
LogPrintf("skip Relaying wtx %s nLockTime %u vs now.%u\n", wtx.GetHash().ToString(),(uint32_t)wtx.nLockTime,now); LogPrintf("skip Relaying wtx %s nLockTime %u vs now.%u\n", wtx.GetHash().ToString(),(uint32_t)wtx.nLockTime,now);
//TODO: EraseFromWallet(wtx.GetHash()); //should be erased, but this creates issues, likely better to create
// vector and do it outside of this loop, but for later
continue; continue;
} }
} }