@@ -1528,12 +1528,12 @@ bool IsInitialBlockDownload()
1528
1528
LOCK (cs_main);
1529
1529
if (fImporting || fReindex )
1530
1530
{
1531
- // fprintf(stderr,"fImporting %d || %d fReindex\n",(int32_t)fImporting,(int32_t)fReindex);
1531
+ // fprintf(stderr,"IsInitialBlockDownload: fImporting %d || %d fReindex\n",(int32_t)fImporting,(int32_t)fReindex);
1532
1532
return true ;
1533
1533
}
1534
1534
if (fCheckpointsEnabled && chainActive.Height () < Checkpoints::GetTotalBlocksEstimate (chainParams.Checkpoints ()))
1535
1535
{
1536
- // fprintf(stderr,"checkpoint -> initialdownload\n");
1536
+ // fprintf(stderr,"IsInitialBlockDownload: checkpoint -> initialdownload\n");
1537
1537
return true ;
1538
1538
}
1539
1539
static bool lockIBDState = false ;
@@ -1542,14 +1542,18 @@ bool IsInitialBlockDownload()
1542
1542
// fprintf(stderr,"lockIBDState true %d < %d\n",chainActive.Height(),pindexBestHeader->nHeight - 10);
1543
1543
return false ;
1544
1544
}
1545
- bool state;
1545
+ bool state; CBlockIndex *ptr = chainActive.Tip ();
1546
+ if ( ptr == 0 )
1547
+ ptr = pindexBestHeader;
1548
+ else if ( pindexBestHeader != 0 && pindexBestHeader->nHeight > ptr->nHeight )
1549
+ ptr = pindexBestHeader;
1546
1550
if ( ASSETCHAINS_SYMBOL[0 ] == 0 )
1547
- state = (chainActive.Height () > 236000 && chainActive.Height () < pindexBestHeader->nHeight - 24 *6 ) ||
1548
- pindexBestHeader->GetBlockTime () < (GetTime () - chainParams.MaxTipAge ());
1549
- else state = (chainActive.Height () < pindexBestHeader->nHeight - 100 );
1551
+ state = (chainActive.Height () < ptr->nHeight - 24 *6 ) ||
1552
+ ptr->GetBlockTime () < (GetTime () - chainParams.MaxTipAge ());
1553
+ else state = (chainActive.Height () < ptr->nHeight - 100 );
1554
+ fprintf (stderr," state.%d ht.%d vs %d, t.%u %u\n " ,state,(int32_t )chainActive.Height (),(uint32_t )ptr->nHeight ,(int32_t )ptr->GetBlockTime (),(uint32_t )(GetTime () - chainParams.MaxTipAge ()));
1550
1555
if (!state)
1551
1556
{
1552
- // fprintf(stderr,"lockIBDState tru\n");
1553
1557
lockIBDState = true ;
1554
1558
}
1555
1559
return state;
0 commit comments