diff options
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index be6afbd320..5bf8bd70e2 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -37,7 +37,6 @@ #include <reverse_iterator.h> #include <script/script.h> #include <script/sigcache.h> -#include <shutdown.h> #include <signet.h> #include <tinyformat.h> #include <txdb.h> @@ -3172,13 +3171,17 @@ bool Chainstate::ActivateBestChain(BlockValidationState& state, std::shared_ptr< GetMainSignals().UpdatedBlockTip(pindexNewTip, pindexFork, fInitialDownload); // Always notify the UI if a new block tip was connected - m_chainman.GetNotifications().blockTip(GetSynchronizationState(fInitialDownload), *pindexNewTip); + if (kernel::IsInterrupted(m_chainman.GetNotifications().blockTip(GetSynchronizationState(fInitialDownload), *pindexNewTip))) { + // Just breaking and returning success for now. This could + // be changed to bubble up the kernel::Interrupted value to + // the caller so the caller could distinguish between + // completed and interrupted operations. + break; + } } } // When we reach this point, we switched to a new tip (stored in pindexNewTip). - if (m_chainman.StopAtHeight() && pindexNewTip && pindexNewTip->nHeight >= m_chainman.StopAtHeight()) StartShutdown(); - if (WITH_LOCK(::cs_main, return m_disabled)) { // Background chainstate has reached the snapshot base block, so exit. break; @@ -3369,7 +3372,14 @@ bool Chainstate::InvalidateBlock(BlockValidationState& state, CBlockIndex* pinde // Only notify about a new block tip if the active chain was modified. if (pindex_was_in_chain) { - m_chainman.GetNotifications().blockTip(GetSynchronizationState(IsInitialBlockDownload()), *to_mark_failed->pprev); + // Ignoring return value for now, this could be changed to bubble up + // kernel::Interrupted value to the caller so the caller could + // distinguish between completed and interrupted operations. It might + // also make sense for the blockTip notification to have an enum + // parameter indicating the source of the tip change so hooks can + // distinguish user-initiated invalidateblock changes from other + // changes. + (void)m_chainman.GetNotifications().blockTip(GetSynchronizationState(IsInitialBlockDownload()), *to_mark_failed->pprev); } return true; } |