Skip to content

backport: bitcoin#25494 index interface decoupling#57

Draft
PastaPastaPasta wants to merge 9 commits into
developfrom
codex/backport-bitcoin-25494
Draft

backport: bitcoin#25494 index interface decoupling#57
PastaPastaPasta wants to merge 9 commits into
developfrom
codex/backport-bitcoin-25494

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

Issue being fixed or feature implemented

Dash's later assumeutxo backports rely on src/kernel/chain.{h,cpp}, but those files and the high-level index notification interfaces were originally introduced by bitcoin#25494. Backporting the complete upstream PR preserves the real file history and lets later backports contain only their own attributable hunks.

What was done?

  • Fully backported all seven commits from indexes: Stop using node internal types bitcoin/bitcoin#25494 in upstream order.
  • Introduced interfaces::BlockInfo, kernel::MakeBlockInfo, and kernel/chain.{h,cpp}.
  • Migrated the base, transaction, block-filter, and coin-stats indexes to the high-level interfaces::Chain, BlockInfo, and BlockKey APIs.
  • Adapted Dash-only AddressIndex, TimestampIndex, and SpentIndex implementations to the same constructor, append, and rewind interfaces.
  • Preserved Dash wallet batching and disconnect-conflict handling, CoinJoin cache invalidation, ChainLock and InstantSend notifications, newer index synchronization/pruning protections, and Dash's existing mempool notification signatures.
  • Updated the circular-dependency expectations for the concrete Dash dependency graph introduced by this refactor.

Upstream PR: bitcoin#25494

How Has This Been Tested?

  • make -j7
  • ./src/test/test_dash --run_test=blockfilter_index_tests,coinstatsindex_tests,txindex_tests
  • test/functional/test_runner.py feature_addressindex.py feature_spentindex.py feature_timestampindex.py feature_index_prune.py
  • test/lint/lint-circular-dependencies.py
  • git diff --check origin/develop...HEAD

All completed successfully on macOS arm64.

Breaking Changes

No externally visible breaking changes. Internal index constructors and extension hooks now use the high-level chain interfaces introduced upstream.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone

ryanofsky and others added 9 commits July 12, 2026 12:47
…otifications

Add interfaces::BlockInfo so block notifications can pass block metadata through the high-level chain interface.

Dash adaptation: preserve the existing mempool notification signatures, wallet batch/conflict handling, CoinJoin cache invalidation, and ChainLock/InstantSend notifications.

Upstream commit: a0b5b4a
…to indexes

Passing abstract Chain interface will let indexes run in separate
processes.

This commit does not change behavior in any way.
…ne function

This commit does not change behavior in any way.
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.
Replace WriteBlock method with CustomAppend and pass BlockInfo struct
instead of CBlockIndex* pointer

This commit does not change behavior in any way.
Replace Rewind method with CustomRewind and pass block hashes and
heights instead of CBlockIndex* pointers

This commit does not change behavior in any way.
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
bitcoin#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.
Migrate Dash-specific address, timestamp, and spent indexes to the Chain-owned BaseIndex constructor and the BlockInfo/BlockKey append and rewind hooks introduced by bitcoin#25494.
Migrate Dash-specific index implementations and shared test setup to the Chain-owned BaseIndex APIs, preserve required locking, and update the expected circular dependency set.
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3ddaf6d0-834e-45a2-9181-bcdb8e69d41b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/backport-bitcoin-25494

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants