HomePhabricator

indexes, refactor: Remove CChainState use in index CommitInternal method

Description

indexes, refactor: Remove CChainState use in index CommitInternal method

Summary:
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
D12622 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.

This is a partial backport of core#25494
https://github.com/bitcoin/bitcoin/pull/25494/commits/7878f97bf15b6e7c9b47d1c0d96419b97e1bdcbd

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D17906

Details

Provenance
Ryan Ofsky <ryan@ofsky.org>Authored on Jan 18 2022, 01:35
PiRKCommitted on Apr 8 2025, 10:31
PiRKPushed on Apr 8 2025, 10:31
Reviewer
Restricted Project
Differential Revision
D17906: indexes, refactor: Remove CChainState use in index CommitInternal method
Parents
rABCb0a72edbe957: [avalanche] Add debug logging when local contenders are set
Branches
Unknown
Tags
Unknown