aboutsummaryrefslogtreecommitdiff
path: root/src/validation.h
diff options
context:
space:
mode:
authorJames O'Beirne <james.obeirne@gmail.com>2019-09-23 14:44:54 -0400
committerJames O'Beirne <james.obeirne@pm.me>2023-09-30 06:38:47 -0400
commit373cf91531b84bfdd06fdf8abf4dca228029ce6b (patch)
tree0038ed40c747e33d8cca9a905fdb07cb539ee5ac /src/validation.h
parent1fffdd76a1bca908f55d73b64983655b14cf7432 (diff)
downloadbitcoin-373cf91531b84bfdd06fdf8abf4dca228029ce6b.tar.xz
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.
Diffstat (limited to 'src/validation.h')
-rw-r--r--src/validation.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/validation.h b/src/validation.h
index 38f57ed1b5..b46b55b650 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -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();
};