Skip to content

backport: bitcoin#25494 index interface decoupling - #57

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

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.

PastaPastaPasta added a commit that referenced this pull request Oct 29, 2026
… partial #59

0b33fee Merge bitcoin-core/bitcoin-maintainer-tools#92: github-merge: Always include repo_from in the merge commit message (pasta)
fe057ee partial bitcoin-core/bitcoin-maintainer-tools#59: github-merge: Format pull_reference in one place (pasta)

Pull request description:

  ## Issue being fixed or feature implemented

  `contrib/devtools/github-merge.py` writes merge subjects as `Merge #N: ...` no matter which repo the PR came from. The v23.1.9 merge-back (dashpay#7961) brings in merges made in dashpay/dash-internal, such as `Merge #2: fix(consensus): reject negative transaction nVersion after DIP3`. Next to public merges like `Merge dashpay#7486: ...` in the same history, there is no way to tell that `#2` is a dash-internal PR rather than dashpay#2.

  Bitcoin Core fixed this after `github-merge.py` moved to bitcoin-core/bitcoin-maintainer-tools (bitcoin#16625, which Dash never took). That is why their history reads `Merge bitcoin/bitcoin#N` / `Merge bitcoin-core/gui#N`. Dash's copy of the script never picked up the change.

  ## What was done?

  Backports two bitcoin-core/bitcoin-maintainer-tools commits to Dash's `github-merge.py`:

  - partial bitcoin-core/bitcoin-maintainer-tools#59 (commit 6e05dc8 only): format the PR reference in one place (`pull_reference`) and use it in the merge subject, the merge-details header and the error messages. The rest of #59 (`push_mirrors`) is unrelated and is omitted. Dash's `print_merge_details()` has no `message` argument, so only its first parameter changes.
  - bitcoin-core/bitcoin-maintainer-tools#92 (commit 3811ce1): always include the repo in the reference. Upstream uses `repo_from`, which comes from bitcoin-core/bitcoin-maintainer-tools#57 (`--repo-from` for monotree fetches). Dash doesn't have #57, so this uses `repo` (`githubmerge.repository`), which is what `repo_from` defaults to upstream.

  No Dash-specific adaptation is needed for dash-internal. When run in a checkout with `githubmerge.repository = dashpay/dash-internal`, merges come out as `Merge dashpay/dash-internal#N`.

  Before / after:

  ```
  Merge #2: fix(consensus): reject negative transaction nVersion after DIP3
  Merge dashpay/dash-internal#2: fix(consensus): reject negative transaction nVersion after DIP3
  ```

  ## How Has This Been Tested?

  Ran the patched script in a throwaway clone against open PRs and answered `x` at the sign prompt, so nothing was committed or pushed. The `git commit` call was wrapped to print the generated subject:

  - `githubmerge.repository = dashpay/dash`, PR 7962 → `Merge dashpay#7962: ci: download Docker release binaries with the workflow token`
  - `githubmerge.repository = dashpay/dash-internal`, PR 13 onto `v23.1.x` → `Merge dashpay/dash-internal#13: ci: let Docker release builds download binaries from a private repo`

  The merge-details header printed `dashpay#7962 ... into develop` and `dashpay/dash-internal#13 ... into v23.1.x`.

  ## Breaking Changes

  None. Only the merge commit subject format changes, to `Merge <owner>/<repo>#N`, which matches the `merge-script` merges already on develop.

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have made corresponding changes to the documentation
  - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

Top commit has no ACKs.

Tree-SHA512: d014624d1b0d47dcf0040d2e76b4bfaadb3f878840acb11ec1af0c476cc97e97463be016c0937aa2229a7b45e4cc35b718681115c643c55a198afa3cbaf09cb0
@PastaPastaPasta

Copy link
Copy Markdown
Owner Author

Superseded by merged dashpay#7462 (bitcoin#25494 index interface decoupling), followed by dashpay#8042.


🤖 Posted autonomously by Codex on behalf of pasta.

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