node: move index ownership to NodeContext #35474

pull w0xlt wants to merge 5 commits into bitcoin:master from w0xlt:global-state-index-nodecontext changing 26 files +256 −172
  1. w0xlt commented at 6:01 PM on June 6, 2026: contributor

    This removes the remaining process-global index ownership and stores node-owned indexes in NodeContext instead.

    Indexes moved:

    • g_txindex
    • g_txospenderindex
    • g_coin_stats_index
    • g_filter_indexes

    NodeContext now owns these index instances, while node.indexes remains a non-owning list used for common index startup, shutdown, and getindexinfo handling.

    Behavior should be unchanged. Indexes are still created from the same startup options, started in the same init step, stopped before destruction, and destroyed while validation_signals is still alive so they can unregister safely.

    The block filter index registry is moved to node/indexes.{h,cpp} so index/ code does not depend on NodeContext. PeerManager receives a small lookup callback instead of reaching into global state.

    Review notes:

    • The first four commits are small and mostly mechanical: move txindex, txospenderindex, and coinstatsindex ownership to NodeContext, then make getindexinfo use node.indexes.
    • The last commit is the main one to review carefully. It moves block filter index ownership to NodeContext, adds node/indexes.{h,cpp}, and wires lookup through PeerManager::Options instead of global state.
  2. node: move txindex ownership to NodeContext 3ae420a074
  3. node: move txospenderindex ownership to NodeContext f45e15866a
  4. node: move coinstatsindex ownership to NodeContext f79ccd8cbc
  5. rpc: get index info from NodeContext indexes cbb018e120
  6. node: move block filter index ownership to NodeContext 1b9cdfe06a
  7. DrahtBot commented at 6:01 PM on June 6, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35474.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK sedited

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34075 (fees: Introduce Mempool Based Fee Estimation to reduce overestimation by ismaelsadeeq)
    • #33854 (fix assumevalid is ignored during reindex by Eunovo)
    • #30437 (ipc: add bitcoin-mine test program by ryanofsky)
    • #19461 (multiprocess: Add bitcoin-gui -ipcconnect option by ryanofsky)
    • #19460 (multiprocess: Add bitcoin-wallet -ipcconnect option by ryanofsky)
    • #10102 (Multiprocess bitcoin by ryanofsky)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

    LLM Linter (✨ experimental)

    Possible typos and grammar issues:

    • Muhash -> MuHash [the term appears to be the MuHash hashing scheme; the current spelling looks incorrect and could confuse readers]

    Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

    • new TxIndex(..., false, do_reindex) in src/init.cpp
    • new TxoSpenderIndex(..., false, do_reindex) in src/init.cpp
    • new CoinStatsIndex(..., false, do_reindex) in src/init.cpp
    • InitBlockFilterIndex(..., false, do_reindex) in src/init.cpp
    • node::InitBlockFilterIndex(..., true, false) in src/test/blockfilter_index_tests.cpp

    <sup>2026-06-06 18:02:26</sup>

  8. sedited commented at 7:48 PM on June 6, 2026: contributor

    Concept ACK

  9. sedited requested review from fjahr on Jun 9, 2026
  10. Sjors commented at 8:22 AM on June 17, 2026: member

    How does this interact with #24230?

  11. w0xlt commented at 5:01 PM on June 17, 2026: contributor

    #24230 still keeps process-global index ownership.

    So this PR is mostly orthogonal to it: #24230 changes how indexes sync with the chain and removes index dependencies on node internals, while this PR moves index ownership into NodeContext.

    There is no conceptual conflict. In terms of code there will be rebase conflicts after one or the other lands, since both touch the index/init/RPC/REST paths.

    Removing process-global index ownership seems aligned with the multiprocess direction anyway.


fjahr


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-06-20 23:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me