Test
This commit is contained in:
15
src/main.cpp
15
src/main.cpp
@@ -2220,8 +2220,6 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
|
|||||||
bool IsInitialBlockDownload()
|
bool IsInitialBlockDownload()
|
||||||
{
|
{
|
||||||
const CChainParams& chainParams = Params();
|
const CChainParams& chainParams = Params();
|
||||||
if ( KOMODO_INSYNC != 0 )
|
|
||||||
return(false);
|
|
||||||
// Once this function has returned false, it must remain false.
|
// Once this function has returned false, it must remain false.
|
||||||
static std::atomic<bool> latchToFalse{false};
|
static std::atomic<bool> latchToFalse{false};
|
||||||
// Optimization: pre-test latch before taking the lock.
|
// Optimization: pre-test latch before taking the lock.
|
||||||
@@ -2234,13 +2232,13 @@ bool IsInitialBlockDownload()
|
|||||||
|
|
||||||
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 true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fCheckpointsEnabled && chainActive.Height() < Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints()))
|
if (fCheckpointsEnabled && chainActive.Height() < Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints()))
|
||||||
{
|
{
|
||||||
//fprintf(stderr,"IsInitialBlockDownload: checkpoint -> initialdownload - %d blocks\n", Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints()));
|
fprintf(stderr,"IsInitialBlockDownload: checkpoint -> initialdownload - %d blocks\n", Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2250,19 +2248,24 @@ bool IsInitialBlockDownload()
|
|||||||
CBlockIndex *ptr = chainActive.Tip();
|
CBlockIndex *ptr = chainActive.Tip();
|
||||||
|
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
|
{
|
||||||
|
fprintf(stderr,"nullptr in IsInitialDownload\n");
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
if (ptr->chainPower < CChainPower(ptr, bigZero, minWork))
|
if (ptr->chainPower < CChainPower(ptr, bigZero, minWork))
|
||||||
|
{
|
||||||
|
fprintf(stderr,"chainpower insufficient in IsInitialDownload\n");
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
state = ((chainActive.Height() < ptr->GetHeight() - 24*60) ||
|
state = ((chainActive.Height() < ptr->GetHeight() - 24*60) ||
|
||||||
ptr->GetBlockTime() < (GetTime() - nMaxTipAge));
|
ptr->GetBlockTime() < (GetTime() - nMaxTipAge));
|
||||||
|
|
||||||
//fprintf(stderr,"state.%d ht.%d vs %d, t.%u %u\n",state,(int32_t)chainActive.Height(),(uint32_t)ptr->GetHeight(),(int32_t)ptr->GetBlockTime(),(uint32_t)(GetTime() - chainParams.MaxTipAge()));
|
|
||||||
if (!state)
|
if (!state)
|
||||||
{
|
{
|
||||||
LogPrintf("Leaving InitialBlockDownload (latching to false)\n");
|
LogPrintf("Leaving InitialBlockDownload (latching to false)\n");
|
||||||
latchToFalse.store(true, std::memory_order_relaxed);
|
latchToFalse.store(true, std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
else fprintf(stderr,"state.%d ht.%d vs %d, t.%u %u\n",state,(int32_t)chainActive.Height(),(uint32_t)ptr->GetHeight(),(int32_t)ptr->GetBlockTime(),(uint32_t)(GetTime() - chainParams.MaxTipAge()));
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user