From 7878f97bf15b6e7c9b47d1c0d96419b97e1bdcbd Mon Sep 17 00:00:00 2001 From: Ryan Ofsky Date: Mon, 17 Jan 2022 20:35:02 -0500 Subject: indexes, refactor: Remove CChainState use in index CommitInternal method Replace CommitInternal method with CustomCommit and use interfaces::Chain instead of CChainState to generate block locator. This commit does not change behavior in any way, except in the (m_best_block_index == nullptr) case, which was added recently in https://github.com/bitcoin/bitcoin/pull/24117 as part of an ongoing attempt to prevent index corruption if bitcoind is interrupted during startup. New behavior in that case should be slightly better than the old behavior (skipping the entire custom+base commit now vs only skipping the base commit previously) and this might avoid more cases of corruption. --- src/index/blockfilterindex.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/index/blockfilterindex.cpp') diff --git a/src/index/blockfilterindex.cpp b/src/index/blockfilterindex.cpp index e223869843..8232567230 100644 --- a/src/index/blockfilterindex.cpp +++ b/src/index/blockfilterindex.cpp @@ -128,7 +128,7 @@ bool BlockFilterIndex::CustomInit(const std::optional& blo return true; } -bool BlockFilterIndex::CommitInternal(CDBBatch& batch) +bool BlockFilterIndex::CustomCommit(CDBBatch& batch) { const FlatFilePos& pos = m_next_filter_pos; @@ -142,7 +142,7 @@ bool BlockFilterIndex::CommitInternal(CDBBatch& batch) } batch.Write(DB_FILTER_POS, pos); - return BaseIndex::CommitInternal(batch); + return true; } bool BlockFilterIndex::ReadFilterFromDisk(const FlatFilePos& pos, const uint256& hash, BlockFilter& filter) const -- cgit v1.2.3