aboutsummaryrefslogtreecommitdiff
path: root/src/index/base.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/index/base.h')
-rw-r--r--src/index/base.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/index/base.h b/src/index/base.h
index 8559e3cb64..df4bdff1ea 100644
--- a/src/index/base.h
+++ b/src/index/base.h
@@ -12,6 +12,7 @@
#include <validationinterface.h>
class CBlockIndex;
+class CChainState;
struct IndexSummary {
std::string name;
@@ -75,14 +76,17 @@ private:
/// to a chain reorganization), the index must halt until Commit succeeds or else it could end up
/// getting corrupted.
bool Commit();
-
protected:
+ CChainState* m_chainstate{nullptr};
+
void BlockConnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* pindex) override;
void ChainStateFlushed(const CBlockLocator& locator) override;
+ const CBlockIndex* CurrentIndex() { return m_best_block_index.load(); };
+
/// Initialize internal state from the database and block index.
- virtual bool Init();
+ [[nodiscard]] virtual bool Init();
/// Write update index entries for a newly connected block.
virtual bool WriteBlock(const CBlock& block, const CBlockIndex* pindex) { return true; }
@@ -109,13 +113,13 @@ public:
/// sync once and only needs to process blocks in the ValidationInterface
/// queue. If the index is catching up from far behind, this method does
/// not block and immediately returns false.
- bool BlockUntilSyncedToCurrentChain() const;
+ bool BlockUntilSyncedToCurrentChain() const LOCKS_EXCLUDED(::cs_main);
void Interrupt();
/// Start initializes the sync state and registers the instance as a
/// ValidationInterface so that it stays in sync with blockchain updates.
- void Start();
+ [[nodiscard]] bool Start(CChainState& active_chainstate);
/// Stops the instance from staying in sync with blockchain updates.
void Stop();