MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / IsInitialBlockDownload

Function IsInitialBlockDownload

src/validation.cpp:1209–1231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1207}
1208
1209bool IsInitialBlockDownload()
1210{
1211 // Once this function has returned false, it must remain false.
1212 static std::atomic<bool> latchToFalse{false};
1213 // Optimization: pre-test latch before taking the lock.
1214 if (latchToFalse.load(std::memory_order_relaxed))
1215 return false;
1216
1217 LOCK(cs_main);
1218 if (latchToFalse.load(std::memory_order_relaxed))
1219 return false;
1220 if (fImporting || fReindex)
1221 return true;
1222 if (chainActive.Tip() == nullptr)
1223 return true;
1224 if (chainActive.Tip()->nChainWork < nMinimumChainWork)
1225 return true;
1226 if (chainActive.Tip()->GetBlockTime() < (GetTime() - nMaxTipAge))
1227 return true;
1228 LogPrintf("Leaving InitialBlockDownload (latching to false)\n");
1229 latchToFalse.store(true, std::memory_order_relaxed);
1230 return false;
1231}
1232
1233CBlockIndex *pindexBestForkTip = nullptr, *pindexBestForkBase = nullptr;
1234

Callers 15

BlockCheckedMethod · 0.85
ProcessHeadersMessageFunction · 0.85
ProcessMessageFunction · 0.85
SendMessagesMethod · 0.85
UpdateTipFunction · 0.85
LOCKS_EXCLUDEDFunction · 0.85
ActivateBestChainMethod · 0.85
InvalidateBlockMethod · 0.85
AcceptBlockMethod · 0.85
FindFilesToPruneFunction · 0.85

Calls 3

GetTimeFunction · 0.85
TipMethod · 0.45
GetBlockTimeMethod · 0.45

Tested by

no test coverage detected