|
37 | 37 | #include <reverse_iterator.h> |
38 | 38 | #include <script/script.h> |
39 | 39 | #include <script/sigcache.h> |
40 | | -#include <shutdown.h> |
41 | 40 | #include <signet.h> |
42 | 41 | #include <tinyformat.h> |
43 | 42 | #include <txdb.h> |
@@ -3172,13 +3171,17 @@ bool Chainstate::ActivateBestChain(BlockValidationState& state, std::shared_ptr< |
3172 | 3171 | GetMainSignals().UpdatedBlockTip(pindexNewTip, pindexFork, fInitialDownload); |
3173 | 3172 |
|
3174 | 3173 | // Always notify the UI if a new block tip was connected |
3175 | | - m_chainman.GetNotifications().blockTip(GetSynchronizationState(fInitialDownload), *pindexNewTip); |
| 3174 | + if (kernel::IsInterrupted(m_chainman.GetNotifications().blockTip(GetSynchronizationState(fInitialDownload), *pindexNewTip))) { |
| 3175 | + // Just breaking and returning success for now. This could |
| 3176 | + // be changed to bubble up the kernel::Interrupted value to |
| 3177 | + // the caller so the caller could distinguish between |
| 3178 | + // completed and interrupted operations. |
| 3179 | + break; |
| 3180 | + } |
3176 | 3181 | } |
3177 | 3182 | } |
3178 | 3183 | // When we reach this point, we switched to a new tip (stored in pindexNewTip). |
3179 | 3184 |
|
3180 | | - if (m_chainman.StopAtHeight() && pindexNewTip && pindexNewTip->nHeight >= m_chainman.StopAtHeight()) StartShutdown(); |
3181 | | - |
3182 | 3185 | if (WITH_LOCK(::cs_main, return m_disabled)) { |
3183 | 3186 | // Background chainstate has reached the snapshot base block, so exit. |
3184 | 3187 | break; |
@@ -3369,7 +3372,14 @@ bool Chainstate::InvalidateBlock(BlockValidationState& state, CBlockIndex* pinde |
3369 | 3372 |
|
3370 | 3373 | // Only notify about a new block tip if the active chain was modified. |
3371 | 3374 | if (pindex_was_in_chain) { |
3372 | | - m_chainman.GetNotifications().blockTip(GetSynchronizationState(IsInitialBlockDownload()), *to_mark_failed->pprev); |
| 3375 | + // Ignoring return value for now, this could be changed to bubble up |
| 3376 | + // kernel::Interrupted value to the caller so the caller could |
| 3377 | + // distinguish between completed and interrupted operations. It might |
| 3378 | + // also make sense for the blockTip notification to have an enum |
| 3379 | + // parameter indicating the source of the tip change so hooks can |
| 3380 | + // distinguish user-initiated invalidateblock changes from other |
| 3381 | + // changes. |
| 3382 | + (void)m_chainman.GetNotifications().blockTip(GetSynchronizationState(IsInitialBlockDownload()), *to_mark_failed->pprev); |
3373 | 3383 | } |
3374 | 3384 | return true; |
3375 | 3385 | } |
|
0 commit comments