diff options
author | Ryan Ofsky <ryan@ofsky.org> | 2022-01-17 20:33:52 -0500 |
---|---|---|
committer | Ryan Ofsky <ryan@ofsky.org> | 2022-07-18 13:39:55 -0500 |
commit | ee3a079fab2c33b4186b62ab822753954a4e545f (patch) | |
tree | 6f38188bc651d5d3ea4a4a295b578b68e94998ba /src/index/blockfilterindex.cpp | |
parent | dc971be0831959e7ee6a6df9e1aa46091351a8fb (diff) | |
download | bitcoin-ee3a079fab2c33b4186b62ab822753954a4e545f.tar.xz |
indexes, refactor: Remove CBlockIndex* uses in index Rewind methods
Replace Rewind method with CustomRewind and pass block hashes and
heights instead of CBlockIndex* pointers
This commit does not change behavior in any way.
Diffstat (limited to 'src/index/blockfilterindex.cpp')
-rw-r--r-- | src/index/blockfilterindex.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/index/blockfilterindex.cpp b/src/index/blockfilterindex.cpp index a8385b89fc..e223869843 100644 --- a/src/index/blockfilterindex.cpp +++ b/src/index/blockfilterindex.cpp @@ -287,17 +287,15 @@ static bool CopyHeightIndexToHashIndex(CDBIterator& db_it, CDBBatch& batch, return true; } -bool BlockFilterIndex::Rewind(const CBlockIndex* current_tip, const CBlockIndex* new_tip) +bool BlockFilterIndex::CustomRewind(const interfaces::BlockKey& current_tip, const interfaces::BlockKey& new_tip) { - assert(current_tip->GetAncestor(new_tip->nHeight) == new_tip); - CDBBatch batch(*m_db); std::unique_ptr<CDBIterator> db_it(m_db->NewIterator()); // During a reorg, we need to copy all filters for blocks that are getting disconnected from the // height index to the hash index so we can still find them when the height index entries are // overwritten. - if (!CopyHeightIndexToHashIndex(*db_it, batch, m_name, new_tip->nHeight, current_tip->nHeight)) { + if (!CopyHeightIndexToHashIndex(*db_it, batch, m_name, new_tip.height, current_tip.height)) { return false; } @@ -307,7 +305,7 @@ bool BlockFilterIndex::Rewind(const CBlockIndex* current_tip, const CBlockIndex* batch.Write(DB_FILTER_POS, m_next_filter_pos); if (!m_db->WriteBatch(batch)) return false; - return BaseIndex::Rewind(current_tip, new_tip); + return true; } static bool LookupOne(const CDBWrapper& db, const CBlockIndex* block_index, DBVal& result) |