mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
validation: indexing changes for assumeutxo
When using an assumedvalid chainstate, only process validationinterface callbacks from the background chainstate within indexes. This ensures that all indexes are built in-order. Later, we can possibly designate indexes which can be built out of order and continue their operation during snapshot use. Once the background sync has completed, restart the indexes so that they continue to index the now-validated snapshot chainstate.
This commit is contained in:
committed by
James O'Beirne
parent
1fffdd76a1
commit
373cf91531
@@ -905,6 +905,10 @@ public:
|
||||
|
||||
explicit ChainstateManager(const util::SignalInterrupt& interrupt, Options options, node::BlockManager::Options blockman_options);
|
||||
|
||||
//! Function to restart active indexes; set dynamically to avoid a circular
|
||||
//! dependency on `base/index.cpp`.
|
||||
std::function<void()> restart_indexes = std::function<void()>();
|
||||
|
||||
const CChainParams& GetParams() const { return m_options.chainparams; }
|
||||
const Consensus::Params& GetConsensus() const { return m_options.chainparams.GetConsensus(); }
|
||||
bool ShouldCheckBlockIndex() const { return *Assert(m_options.check_block_index); }
|
||||
@@ -1227,6 +1231,16 @@ public:
|
||||
//! @sa node/chainstate:LoadChainstate()
|
||||
bool ValidatedSnapshotCleanup() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||
|
||||
//! @returns the chainstate that indexes should consult when ensuring that an
|
||||
//! index is synced with a chain where we can expect block index entries to have
|
||||
//! BLOCK_HAVE_DATA beneath the tip.
|
||||
//!
|
||||
//! In other words, give us the chainstate for which we can reasonably expect
|
||||
//! that all blocks beneath the tip have been indexed. In practice this means
|
||||
//! when using an assumed-valid chainstate based upon a snapshot, return only the
|
||||
//! fully validated chain.
|
||||
Chainstate& GetChainstateForIndexing() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||
|
||||
~ChainstateManager();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user