| 4262 | } |
| 4263 | |
| 4264 | bool CChainState::LoadChainTip() |
| 4265 | { |
| 4266 | AssertLockHeld(cs_main); |
| 4267 | const CCoinsViewCache& coins_cache = CoinsTip(); |
| 4268 | assert(!coins_cache.GetBestBlock().IsNull()); // Never called when the coins view is empty |
| 4269 | const CBlockIndex* tip = m_chain.Tip(); |
| 4270 | |
| 4271 | if (tip && tip->GetBlockHash() == coins_cache.GetBestBlock()) { |
| 4272 | return true; |
| 4273 | } |
| 4274 | |
| 4275 | // Load pointer to end of best chain |
| 4276 | CBlockIndex* pindex = m_blockman.LookupBlockIndex(coins_cache.GetBestBlock()); |
| 4277 | if (!pindex) { |
| 4278 | return false; |
| 4279 | } |
| 4280 | m_chain.SetTip(pindex); |
| 4281 | PruneBlockIndexCandidates(); |
| 4282 | |
| 4283 | tip = m_chain.Tip(); |
| 4284 | LogPrintf("Loaded best chain: hashBestChain=%s height=%d date=%s progress=%f\n", |
| 4285 | tip->GetBlockHash().ToString(), |
| 4286 | m_chain.Height(), |
| 4287 | FormatISO8601DateTime(tip->GetBlockTime()), |
| 4288 | GuessVerificationProgress(tip, m_params.GetConsensus().nPowTargetSpacing)); |
| 4289 | return true; |
| 4290 | } |
| 4291 | |
| 4292 | CVerifyDB::CVerifyDB() |
| 4293 | { |
no test coverage detected