|
|
|
@ -2800,6 +2800,13 @@ bool CChainState::ActivateBestChainStep(BlockValidationState& state, const CChai
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static SynchronizationState GetSynchronizationState(bool init)
|
|
|
|
|
{
|
|
|
|
|
if (!init) return SynchronizationState::POST_INIT;
|
|
|
|
|
if (::fReindex) return SynchronizationState::INIT_REINDEX;
|
|
|
|
|
return SynchronizationState::INIT_DOWNLOAD;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool NotifyHeaderTip() LOCKS_EXCLUDED(cs_main) {
|
|
|
|
|
bool fNotify = false;
|
|
|
|
|
bool fInitialBlockDownload = false;
|
|
|
|
@ -2817,7 +2824,7 @@ static bool NotifyHeaderTip() LOCKS_EXCLUDED(cs_main) {
|
|
|
|
|
}
|
|
|
|
|
// Send block tip changed notifications without cs_main
|
|
|
|
|
if (fNotify) {
|
|
|
|
|
uiInterface.NotifyHeaderTip(fInitialBlockDownload, pindexHeader);
|
|
|
|
|
uiInterface.NotifyHeaderTip(GetSynchronizationState(fInitialBlockDownload), pindexHeader);
|
|
|
|
|
}
|
|
|
|
|
return fNotify;
|
|
|
|
|
}
|
|
|
|
@ -2906,7 +2913,7 @@ bool CChainState::ActivateBestChain(BlockValidationState &state, const CChainPar
|
|
|
|
|
GetMainSignals().UpdatedBlockTip(pindexNewTip, pindexFork, fInitialDownload);
|
|
|
|
|
|
|
|
|
|
// Always notify the UI if a new block tip was connected
|
|
|
|
|
uiInterface.NotifyBlockTip(fInitialDownload, pindexNewTip);
|
|
|
|
|
uiInterface.NotifyBlockTip(GetSynchronizationState(fInitialDownload), pindexNewTip);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// When we reach this point, we switched to a new tip (stored in pindexNewTip).
|
|
|
|
@ -3097,7 +3104,7 @@ bool CChainState::InvalidateBlock(BlockValidationState& state, const CChainParam
|
|
|
|
|
|
|
|
|
|
// Only notify about a new block tip if the active chain was modified.
|
|
|
|
|
if (pindex_was_in_chain) {
|
|
|
|
|
uiInterface.NotifyBlockTip(IsInitialBlockDownload(), to_mark_failed->pprev);
|
|
|
|
|
uiInterface.NotifyBlockTip(GetSynchronizationState(IsInitialBlockDownload()), to_mark_failed->pprev);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|