Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
| Show First 20 Lines • Show All 2,930 Lines • ▼ Show 20 Lines | do { | ||||
| if (GetMainSignals().CallbacksPending() > 10) { | if (GetMainSignals().CallbacksPending() > 10) { | ||||
| // Block until the validation queue drains. This should largely | // Block until the validation queue drains. This should largely | ||||
| // never happen in normal operation, however may happen during | // never happen in normal operation, however may happen during | ||||
| // reindex, causing memory blowup if we run too far ahead. | // reindex, causing memory blowup if we run too far ahead. | ||||
| SyncWithValidationInterfaceQueue(); | SyncWithValidationInterfaceQueue(); | ||||
| } | } | ||||
| if (ShutdownRequested()) { | |||||
| break; | |||||
| } | |||||
| const CBlockIndex *pindexFork; | const CBlockIndex *pindexFork; | ||||
| bool fInitialDownload; | bool fInitialDownload; | ||||
| { | { | ||||
| LOCK(cs_main); | LOCK(cs_main); | ||||
| // Destructed before cs_main is unlocked. | // Destructed before cs_main is unlocked. | ||||
| ConnectTrace connectTrace(g_mempool); | ConnectTrace connectTrace(g_mempool); | ||||
| ▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | do { | ||||
| if (pindexFork != pindexNewTip) { | if (pindexFork != pindexNewTip) { | ||||
| uiInterface.NotifyBlockTip(fInitialDownload, pindexNewTip); | uiInterface.NotifyBlockTip(fInitialDownload, pindexNewTip); | ||||
| } | } | ||||
| if (nStopAtHeight && pindexNewTip && | if (nStopAtHeight && pindexNewTip && | ||||
| pindexNewTip->nHeight >= nStopAtHeight) { | pindexNewTip->nHeight >= nStopAtHeight) { | ||||
| StartShutdown(); | StartShutdown(); | ||||
| } | } | ||||
| // We check shutdown only after giving ActivateBestChainStep a chance to | |||||
| // run once so that we never shutdown before connecting the genesis | |||||
| // block during LoadChainTip(). Previously this caused an assert() | |||||
| // failure during shutdown in such cases as the UTXO DB flushing checks | |||||
| // that the best block hash is non-null. | |||||
| if (ShutdownRequested()) { | |||||
| break; | |||||
| } | |||||
| } while (pindexNewTip != pindexMostWork); | } while (pindexNewTip != pindexMostWork); | ||||
| const CChainParams ¶ms = config.GetChainParams(); | const CChainParams ¶ms = config.GetChainParams(); | ||||
| CheckBlockIndex(params.GetConsensus()); | CheckBlockIndex(params.GetConsensus()); | ||||
| // Write changes periodically to disk, after relay. | // Write changes periodically to disk, after relay. | ||||
| if (!FlushStateToDisk(params, state, FlushStateMode::PERIODIC)) { | if (!FlushStateToDisk(params, state, FlushStateMode::PERIODIC)) { | ||||
| return false; | return false; | ||||
| ▲ Show 20 Lines • Show All 2,701 Lines • Show Last 20 Lines | |||||