{
 "number": 35474,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/35474",
 "title": "node: move index ownership to NodeContext",
 "author": "w0xlt",
 "author_association": "CONTRIBUTOR",
 "created_at": "2026-06-06T18:01:47Z",
 "updated_at": "2026-09-16T23:53:11Z",
 "age_days": 102,
 "draft": false,
 "labels": [
  "Refactoring",
  "UTXO Db and Indexes"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "3c05b4eb83b03399ae1dac579b5cf9a7fec2bcf5",
 "head_ref": "global-state-index-nodecontext",
 "head_repo": "w0xlt/bitcoin",
 "head_history": [
  {
   "t": "2026-08-18T21:59:51Z",
   "sha": "c4f9a96ad64a9ef74dda043a531fc5fb1d944a65"
  },
  {
   "t": "2026-09-15T23:00:13Z",
   "sha": "3c05b4eb83b03399ae1dac579b5cf9a7fec2bcf5"
  }
 ],
 "additions": 255,
 "deletions": 175,
 "changed_files": 27,
 "commit_count": 5,
 "size_bucket": "L",
 "mergeable_state": "clean",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "concept_ack": [
     {
      "login": "sedited",
      "url": "https://github.com/bitcoin/bitcoin/pull/35474#issuecomment-4640184703"
     },
     {
      "login": "fjahr",
      "url": "https://github.com/bitcoin/bitcoin/pull/35474#issuecomment-4762314544"
     }
    ]
   },
   "conflicts": [
    {
     "number": 36244,
     "title": "validation, net: Process blocks asynchronously and reduce cs_main contention",
     "author": "w0xlt"
    },
    {
     "number": 36167,
     "title": "[RFC] Enable `-Wunused`",
     "author": "fanquake"
    },
    {
     "number": 36002,
     "title": "txindex: allow running in pruned mode",
     "author": "andrewtoth"
    },
    {
     "number": 35642,
     "title": "headersync: do parameter search at runtime",
     "author": "sipa"
    },
    {
     "number": 34132,
     "title": "coins, dbwrapper: remove error catcher, make point-read failures fatal",
     "author": "l0rinc"
    },
    {
     "number": 30437,
     "title": "ipc: add bitcoin-mine test program",
     "author": "ryanofsky"
    },
    {
     "number": 19461,
     "title": "multiprocess: Add bitcoin-gui -ipcconnect option",
     "author": "ryanofsky"
    },
    {
     "number": 19460,
     "title": "multiprocess: Add bitcoin-wallet -ipcconnect option",
     "author": "ryanofsky"
    },
    {
     "number": 10102,
     "title": "Multiprocess bitcoin",
     "author": "ryanofsky"
    }
   ]
  }
 },
 "acks_parsed": {
  "sedited": {
   "kind": "concept_ack",
   "hash": null,
   "t": "2026-06-06T19:48:02Z",
   "stale": false
  },
  "fjahr": {
   "kind": "concept_ack",
   "hash": null,
   "t": "2026-06-21T14:41:28Z",
   "stale": false
  }
 },
 "acks_tally": {
  "ack": 0,
  "stale_ack": 0,
  "concept_ack": 2,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "Sjors",
   "fjahr",
   "sedited"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "clean",
  "last_author_activity": "2026-09-15T23:03:15Z",
  "last_reviewer_activity": "2026-08-17T09:38:38Z",
  "last_reviewer": "sedited",
  "author_silent_days": 1,
  "waiting_on_author_days": 0,
  "days_since_update": 0
 },
 "refs": {
  "mentioned": [
   24230
  ],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [
   {
    "number": 24230,
    "type": "pull",
    "state": "open",
    "merged": false,
    "merged_at": null,
    "title": "indexes: Stop using node internal types and locking cs_main, improve sync logic"
   }
  ],
  "conflicts": [
   36244,
   36167,
   36002,
   35642,
   34132,
   30437,
   19461,
   19460,
   10102
  ]
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [],
 "body": "This removes the remaining process-global index ownership and stores node-owned indexes in `NodeContext` instead.\n\nIndexes moved:\n\n- `g_txindex`\n- `g_txospenderindex`\n- `g_coin_stats_index`\n- `g_filter_indexes`\n\n`NodeContext` now owns these index instances, while `node.indexes` remains a non-owning list used for common index startup, shutdown, and `getindexinfo` handling.\n\nBehavior 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.\n\nThe 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.\n\nReview notes:\n- The first four commits are small and mostly mechanical: move `txindex`, `txospenderindex`, and `coinstatsindex` ownership to `NodeContext`, then make `getindexinfo` use `node.indexes`.\n- 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.",
 "commits": [
  {
   "sha": "cd47f1c6bc8bce908e2cee30173ebaeb1fe9aa27",
   "date": "2026-09-15T22:53:57Z",
   "message": "node: move txindex ownership to NodeContext"
  },
  {
   "sha": "72a48b4dffba1e64f34fc52b831a20ddc9446bf9",
   "date": "2026-09-15T22:54:12Z",
   "message": "node: move txospenderindex ownership to NodeContext"
  },
  {
   "sha": "22e06b1bd746bdd1eb802b1f9a2c5bfd34c329fd",
   "date": "2026-09-15T22:54:21Z",
   "message": "node: move coinstatsindex ownership to NodeContext"
  },
  {
   "sha": "7cad62f4859f6c5913be79f30a4ebfe6970556b6",
   "date": "2026-09-15T22:54:33Z",
   "message": "rpc: get index info from NodeContext indexes"
  },
  {
   "sha": "3c05b4eb83b03399ae1dac579b5cf9a7fec2bcf5",
   "date": "2026-09-15T22:56:06Z",
   "message": "node: move block filter index ownership to NodeContext"
  }
 ],
 "timeline": [
  {
   "t": "2026-06-06T19:48:02Z",
   "kind": "comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "text": "Concept ACK"
  },
  {
   "t": "2026-06-17T08:22:48Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "How does this interact with #24230?"
  },
  {
   "t": "2026-06-17T17:01:14Z",
   "kind": "comment",
   "who": "w0xlt",
   "assoc": "CONTRIBUTOR",
   "text": "https://github.com/bitcoin/bitcoin/pull/24230 still keeps process-global index ownership.\n\nSo 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`.\n\nThere is no conceptual conflict.\nIn terms of code there will be rebase conflicts after one or the other lands, since both touch the index/init/RPC/REST paths.\n\nRemoving process-global index ownership seems aligned with the multiprocess direction anyway."
  },
  {
   "t": "2026-06-21T14:41:28Z",
   "kind": "comment",
   "who": "fjahr",
   "assoc": "MEMBER",
   "text": "Concept ACK"
  },
  {
   "t": "2026-08-17T09:38:38Z",
   "kind": "comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "text": "Ping for rebase @w0xlt"
  },
  {
   "t": "2026-08-18T21:59:51Z",
   "kind": "force_push",
   "who": "w0xlt",
   "commit": "c4f9a96ad64a9ef74dda043a531fc5fb1d944a65"
  },
  {
   "t": "2026-08-18T22:00:42Z",
   "kind": "comment",
   "who": "w0xlt",
   "assoc": "CONTRIBUTOR",
   "text": "Rebased. Thanks @sedited"
  },
  {
   "t": "2026-09-15T23:00:13Z",
   "kind": "force_push",
   "who": "w0xlt",
   "commit": "3c05b4eb83b03399ae1dac579b5cf9a7fec2bcf5"
  },
  {
   "t": "2026-09-15T23:03:15Z",
   "kind": "comment",
   "who": "w0xlt",
   "assoc": "CONTRIBUTOR",
   "text": "Reabsed"
  }
 ],
 "labels_log": [
  {
   "t": "2026-07-09T13:45:52Z",
   "action": "labeled",
   "label": "Refactoring",
   "who": "willcl-ark"
  },
  {
   "t": "2026-07-09T13:45:52Z",
   "action": "labeled",
   "label": "UTXO Db and Indexes",
   "who": "willcl-ark"
  },
  {
   "t": "2026-07-14T21:15:30Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-08-18T23:23:26Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-08-21T08:26:31Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-09-16T00:21:35Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  }
 ],
 "state_log": [],
 "text_chars": 2172,
 "text_tokens_estimate": 543,
 "changed_paths": [
  "src/CMakeLists.txt",
  "src/index/blockfilterindex.cpp",
  "src/index/blockfilterindex.h",
  "src/index/coinstatsindex.cpp",
  "src/index/coinstatsindex.h",
  "src/index/txindex.cpp",
  "src/index/txindex.h",
  "src/index/txospenderindex.cpp",
  "src/index/txospenderindex.h",
  "src/init.cpp",
  "src/net_processing.cpp",
  "src/net_processing.h",
  "src/node/context.h",
  "src/node/indexes.cpp",
  "src/node/indexes.h",
  "src/node/interfaces.cpp",
  "src/node/transaction.cpp",
  "src/node/transaction.h",
  "src/rest.cpp",
  "src/rpc/blockchain.cpp",
  "src/rpc/mempool.cpp",
  "src/rpc/node.cpp",
  "src/rpc/rawtransaction.cpp",
  "src/rpc/txoutproof.cpp",
  "src/test/blockfilter_index_tests.cpp",
  "src/test/util/setup_common.cpp",
  "src/wallet/test/wallet_tests.cpp"
 ],
 "files": [
  {
   "path": "src/CMakeLists.txt",
   "add": 1,
   "del": 0
  },
  {
   "path": "src/index/blockfilterindex.cpp",
   "add": 0,
   "del": 35
  },
  {
   "path": "src/index/blockfilterindex.h",
   "add": 0,
   "del": 27
  },
  {
   "path": "src/index/coinstatsindex.cpp",
   "add": 0,
   "del": 2
  },
  {
   "path": "src/index/coinstatsindex.h",
   "add": 0,
   "del": 3
  },
  {
   "path": "src/index/txindex.cpp",
   "add": 0,
   "del": 2
  },
  {
   "path": "src/index/txindex.h",
   "add": 0,
   "del": 3
  },
  {
   "path": "src/index/txospenderindex.cpp",
   "add": 0,
   "del": 2
  },
  {
   "path": "src/index/txospenderindex.h",
   "add": 0,
   "del": 4
  },
  {
   "path": "src/init.cpp",
   "add": 20,
   "del": 13
  },
  {
   "path": "src/net_processing.cpp",
   "add": 1,
   "del": 1
  },
  {
   "path": "src/net_processing.h",
   "add": 5,
   "del": 0
  },
  {
   "path": "src/node/context.h",
   "add": 24,
   "del": 1
  },
  {
   "path": "src/node/indexes.cpp",
   "add": 65,
   "del": 0
  },
  {
   "path": "src/node/indexes.h",
   "add": 51,
   "del": 0
  },
  {
   "path": "src/node/interfaces.cpp",
   "add": 3,
   "del": 2
  },
  {
   "path": "src/node/transaction.cpp",
   "add": 3,
   "del": 3
  },
  {
   "path": "src/node/transaction.h",
   "add": 4,
   "del": 2
  },
  {
   "path": "src/rest.cpp",
   "add": 12,
   "del": 7
  },
  {
   "path": "src/rpc/blockchain.cpp",
   "add": 19,
   "del": 14
  },
  {
   "path": "src/rpc/mempool.cpp",
   "add": 6,
   "del": 8
  },
  {
   "path": "src/rpc/node.cpp",
   "add": 3,
   "del": 18
  },
  {
   "path": "src/rpc/rawtransaction.cpp",
   "add": 7,
   "del": 7
  },
  {
   "path": "src/rpc/txoutproof.cpp",
   "add": 7,
   "del": 4
  },
  {
   "path": "src/test/blockfilter_index_tests.cpp",
   "add": 12,
   "del": 11
  },
  {
   "path": "src/test/util/setup_common.cpp",
   "add": 5,
   "del": 0
  },
  {
   "path": "src/wallet/test/wallet_tests.cpp",
   "add": 7,
   "del": 6
  }
 ],
 "test_lines": 41,
 "git": {
  "head": "3c05b4eb83b03399ae1dac579b5cf9a7fec2bcf5",
  "head_matches_backup": true,
  "base": "57721f8074c2e8ccfe4c6d10114d4683dca58118",
  "commits": [
   {
    "sha": "cd47f1c6bc",
    "subject": "node: move txindex ownership to NodeContext",
    "files": 11,
    "add": 36,
    "del": 32
   },
   {
    "sha": "72a48b4dff",
    "subject": "node: move txospenderindex ownership to NodeContext",
    "files": 7,
    "add": 14,
    "del": 19
   },
   {
    "sha": "22e06b1bd7",
    "subject": "node: move coinstatsindex ownership to NodeContext",
    "files": 7,
    "add": 20,
    "del": 20
   },
   {
    "sha": "7cad62f485",
    "subject": "rpc: get index info from NodeContext indexes",
    "files": 1,
    "add": 2,
    "del": 18
   },
   {
    "sha": "3c05b4eb83",
    "subject": "node: move block filter index ownership to NodeContext",
    "files": 16,
    "add": 198,
    "del": 101
   }
  ],
  "patch_truncated": true
 },
 "input_hash": "6a51ccab9c75d2eb",
 "extracted_at": "2026-09-17T16:15:31+00:00"
}