mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge 01e5d6b105 into merged_master (Bitcoin PR bitcoin/bitcoin#28048)
This commit is contained in:
commit
e17c92ebb1
10 changed files with 56 additions and 17 deletions
|
|
@ -40,7 +40,6 @@
|
|||
#include <reverse_iterator.h>
|
||||
#include <script/script.h>
|
||||
#include <script/sigcache.h>
|
||||
#include <shutdown.h>
|
||||
#include <signet.h>
|
||||
#include <timedata.h>
|
||||
#include <tinyformat.h>
|
||||
|
|
@ -2769,7 +2768,7 @@ bool Chainstate::FlushStateToDisk(
|
|||
if (m_chainman.m_best_header && (uint64_t)m_chainman.m_best_header->nHeight > node::nMustKeepFullHeaders) { // check first, to prevent underflow
|
||||
trim_height = m_chainman.m_best_header->nHeight - node::nMustKeepFullHeaders;
|
||||
}
|
||||
if (node::fTrimHeaders && trim_height > 0 && !ShutdownRequested()) {
|
||||
if (node::fTrimHeaders && trim_height > 0) {
|
||||
static int nMinTrimHeight{0};
|
||||
LogPrintf("Flushing block index, trimming headers, setTrimmableBlockIndex.size(): %d\n", setTrimmableBlockIndex.size());
|
||||
for (std::set<CBlockIndex*>::iterator it = setTrimmableBlockIndex.begin(); it != setTrimmableBlockIndex.end(); it++) {
|
||||
|
|
@ -3505,7 +3504,13 @@ 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).
|
||||
|
|
@ -3515,8 +3520,6 @@ bool Chainstate::ActivateBestChain(BlockValidationState& state, std::shared_ptr<
|
|||
break;
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
@ -3707,7 +3710,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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue