diff options
author | Ryan Ofsky <ryan@ofsky.org> | 2022-01-17 18:36:40 -0500 |
---|---|---|
committer | Ryan Ofsky <ryan@ofsky.org> | 2022-07-18 13:39:55 -0500 |
commit | bef4e405f3de2718dfee279a9abff4daf016da26 (patch) | |
tree | 52a53b50ad0da1ae8dcf59dc1a0ef174df1381e8 /src/index/blockfilterindex.cpp | |
parent | addb4f2af183a25ce4a6b6485b5b49575a2ba31b (diff) | |
download | bitcoin-bef4e405f3de2718dfee279a9abff4daf016da26.tar.xz |
indexes, refactor: Remove CBlockIndex* uses in index Init methods
Replace overriden index Init() methods that use the best block
CBlockIndex* pointer with pure CustomInit() callbacks that are passed
the block hash and height.
This gets rid of more CBlockIndex* pointer uses so indexes can work
outside the bitcoin-node process. It also simplifies the initialization
call sequence so index implementations are not responsible for
initializing the base class.
There is a slight change in behavior here since now the best block
pointer is loaded and checked before the custom index init functions are
called instead of while they are called.
Diffstat (limited to 'src/index/blockfilterindex.cpp')
-rw-r--r-- | src/index/blockfilterindex.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/index/blockfilterindex.cpp b/src/index/blockfilterindex.cpp index 15a7cfeaea..f44b5ac6e8 100644 --- a/src/index/blockfilterindex.cpp +++ b/src/index/blockfilterindex.cpp @@ -109,7 +109,7 @@ BlockFilterIndex::BlockFilterIndex(std::unique_ptr<interfaces::Chain> chain, Blo m_filter_fileseq = std::make_unique<FlatFileSeq>(std::move(path), "fltr", FLTR_FILE_CHUNK_SIZE); } -bool BlockFilterIndex::Init() +bool BlockFilterIndex::CustomInit(const std::optional<interfaces::BlockKey>& block) { if (!m_db->Read(DB_FILTER_POS, m_next_filter_pos)) { // Check that the cause of the read failure is that the key does not exist. Any other errors @@ -124,7 +124,7 @@ bool BlockFilterIndex::Init() m_next_filter_pos.nFile = 0; m_next_filter_pos.nPos = 0; } - return BaseIndex::Init(); + return true; } bool BlockFilterIndex::CommitInternal(CDBBatch& batch) |