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);
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);
}
}

View File

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

View File

@@ -796,7 +796,7 @@ int32_t waitForPeers(const CChainParams &chainparams)
LOCK(cs_vNodes);
fvNodesEmpty = vNodes.empty();
}
if (!IsInSync() || fvNodesEmpty)
if (fvNodesEmpty || !IsInSync())
{
do {
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 )
{
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;
}
}