aboutsummaryrefslogtreecommitdiff
path: root/src/index/base.h
diff options
context:
space:
mode:
authorRyan Ofsky <ryan@ofsky.org>2022-01-13 07:57:54 -0500
committerRyan Ofsky <ryan@ofsky.org>2022-07-18 13:39:55 -0500
commit33b4d48cfcdf145f49cb2283ac3e2936a4e23fff (patch)
tree482ca2545df1e67a06a7d027cc2275f89ae0cb75 /src/index/base.h
parenta0b5b4ae5a24536d333cbce2ea584f2d935c651f (diff)
downloadbitcoin-33b4d48cfcdf145f49cb2283ac3e2936a4e23fff.tar.xz
indexes, refactor: Pass Chain interface instead of CChainState class to indexes
Passing abstract Chain interface will let indexes run in separate processes. This commit does not change behavior in any way.
Diffstat (limited to 'src/index/base.h')
-rw-r--r--src/index/base.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/index/base.h b/src/index/base.h
index a8f6a18c8d..3586376459 100644
--- a/src/index/base.h
+++ b/src/index/base.h
@@ -6,12 +6,16 @@
#define BITCOIN_INDEX_BASE_H
#include <dbwrapper.h>
+#include <interfaces/chain.h>
#include <threadinterrupt.h>
#include <validationinterface.h>
class CBlock;
class CBlockIndex;
class CChainState;
+namespace interfaces {
+class Chain;
+} // namespace interfaces
struct IndexSummary {
std::string name;
@@ -79,6 +83,7 @@ private:
virtual bool AllowPrune() const = 0;
protected:
+ std::unique_ptr<interfaces::Chain> m_chain;
CChainState* m_chainstate{nullptr};
void BlockConnected(const std::shared_ptr<const CBlock>& block, const CBlockIndex* pindex) override;
@@ -110,6 +115,7 @@ protected:
void SetBestBlockIndex(const CBlockIndex* block);
public:
+ BaseIndex(std::unique_ptr<interfaces::Chain> chain);
/// Destructor interrupts sync thread if running and blocks until it exits.
virtual ~BaseIndex();
@@ -124,7 +130,7 @@ public:
/// Start initializes the sync state and registers the instance as a
/// ValidationInterface so that it stays in sync with blockchain updates.
- [[nodiscard]] bool Start(CChainState& active_chainstate);
+ [[nodiscard]] bool Start();
/// Stops the instance from staying in sync with blockchain updates.
void Stop();