| 1632 | |
| 1633 | bool fForceInitialBlockDownload = false; |
| 1634 | bool IsInitialBlockDownload() |
| 1635 | { |
| 1636 | if (fForceInitialBlockDownload) |
| 1637 | return false; |
| 1638 | |
| 1639 | const CChainParams& chainParams = Params(); |
| 1640 | LOCK(cs_main); |
| 1641 | if (fImporting || fReindex) |
| 1642 | return true; |
| 1643 | if (fCheckpointsEnabled && chainActive.Height() < Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints())) |
| 1644 | return true; |
| 1645 | static bool lockIBDState = false; |
| 1646 | if (lockIBDState) |
| 1647 | return false; |
| 1648 | bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 || |
| 1649 | std::max(chainActive.Tip()->GetBlockTime(), pindexBestHeader->GetBlockTime()) < GetTime() - 24 * 60 * 60); |
| 1650 | if (!state) { |
| 1651 | lockIBDState = true; |
| 1652 | LogPrintf("No longer initial block download\n"); |
| 1653 | } |
| 1654 | return state; |
| 1655 | } |
| 1656 | |
| 1657 | bool fLargeWorkForkFound = false; |
| 1658 | bool fLargeWorkInvalidChainFound = false; |
no test coverage detected