From b918f4fa44cacb0daad5a35971b34deeac3af43e Mon Sep 17 00:00:00 2001 From: josie Date: Tue, 12 May 2026 20:16:57 +0200 Subject: [PATCH] nuke: indexes + compact-filters (src, build, ci, tests, docs) Co-Authored-By: Claude Opus 4.7 (1M context) --- doc/REST-interface.md | 20 +- doc/bips.md | 2 - doc/developer-notes.md | 3 - doc/files.md | 5 - src/CMakeLists.txt | 6 - src/bench/CMakeLists.txt | 2 - src/bench/gcs_filter.cpp | 93 ---- src/bench/index_blockfilter.cpp | 62 --- src/bitcoin-cli.cpp | 1 - src/blockfilter.cpp | 256 --------- src/blockfilter.h | 176 ------ src/index/base.cpp | 510 ------------------ src/index/base.h | 184 ------- src/index/blockfilterindex.cpp | 464 ---------------- src/index/blockfilterindex.h | 126 ----- src/index/coinstatsindex.cpp | 403 -------------- src/index/coinstatsindex.h | 78 --- src/index/db_key.h | 116 ---- src/index/disktxpos.h | 26 - src/index/txindex.cpp | 120 ----- src/index/txindex.h | 60 --- src/index/txospenderindex.cpp | 183 ------- src/index/txospenderindex.h | 75 --- src/init.cpp | 193 +------ src/init.h | 3 - src/interfaces/chain.h | 8 - src/kernel/coinstats.h | 26 - src/net.cpp | 12 +- src/net_processing.cpp | 237 -------- src/net_processing.h | 1 - src/node/caches.cpp | 26 +- src/node/caches.h | 8 +- src/node/context.h | 2 - src/node/interfaces.cpp | 16 - src/node/transaction.cpp | 14 - src/node/transaction.h | 5 +- src/protocol.cpp | 1 - src/protocol.h | 45 -- src/rest.cpp | 222 -------- src/rpc/blockchain.cpp | 459 +--------------- src/rpc/client.cpp | 11 - src/rpc/mempool.cpp | 148 ----- src/rpc/node.cpp | 69 +-- src/rpc/rawtransaction.cpp | 15 +- src/rpc/txoutproof.cpp | 7 - src/test/CMakeLists.txt | 6 - src/test/blockfilter_index_tests.cpp | 388 ------------- src/test/blockfilter_tests.cpp | 191 ------- src/test/coinstatsindex_tests.cpp | 113 ---- src/test/data/blockfilters.json | 13 - src/test/fuzz/CMakeLists.txt | 1 - src/test/fuzz/blockfilter.cpp | 47 -- src/test/fuzz/deserialize.cpp | 5 - src/test/fuzz/golomb_rice.cpp | 5 +- src/test/fuzz/rpc.cpp | 4 - src/test/fuzz/string.cpp | 3 - src/test/netbase_tests.cpp | 6 +- src/test/txindex_tests.cpp | 69 --- src/test/txospenderindex_tests.cpp | 77 --- src/test/util/CMakeLists.txt | 1 - src/test/util/blockfilter.cpp | 31 -- src/test/util/blockfilter.h | 17 - src/test/util/net.h | 1 - src/validation.cpp | 5 - test/functional/feature_assumeutxo.py | 36 +- test/functional/feature_coinstatsindex.py | 341 ------------ .../feature_coinstatsindex_compatibility.py | 64 --- test/functional/feature_index_prune.py | 207 ------- test/functional/feature_init.py | 70 +-- test/functional/feature_pruning.py | 22 +- test/functional/feature_reindex.py | 20 - test/functional/interface_rest.py | 26 +- test/functional/interface_usdt_utxocache.py | 1 - test/functional/mempool_packages.py | 6 - test/functional/p2p_blockfilters.py | 286 ---------- test/functional/rpc_getblockfilter.py | 64 --- test/functional/rpc_gettxspendingprevout.py | 217 -------- test/functional/rpc_misc.py | 26 - test/functional/rpc_rawtransaction.py | 58 +- test/functional/rpc_scanblocks.py | 139 ----- test/functional/rpc_txoutproof.py | 16 +- test/functional/test_framework/blockfilter.py | 49 -- test/functional/test_framework/messages.py | 151 ------ test/functional/test_framework/p2p.py | 12 - test/functional/test_framework/util.py | 6 - test/functional/test_framework/v2_p2p.py | 6 - test/functional/test_runner.py | 6 - test/functional/tool_utxo_to_sqlite.py | 8 +- test/lint/lint-circular-dependencies.py | 3 - 89 files changed, 74 insertions(+), 7248 deletions(-) delete mode 100644 src/bench/gcs_filter.cpp delete mode 100644 src/bench/index_blockfilter.cpp delete mode 100644 src/blockfilter.cpp delete mode 100644 src/blockfilter.h delete mode 100644 src/index/base.cpp delete mode 100644 src/index/base.h delete mode 100644 src/index/blockfilterindex.cpp delete mode 100644 src/index/blockfilterindex.h delete mode 100644 src/index/coinstatsindex.cpp delete mode 100644 src/index/coinstatsindex.h delete mode 100644 src/index/db_key.h delete mode 100644 src/index/disktxpos.h delete mode 100644 src/index/txindex.cpp delete mode 100644 src/index/txindex.h delete mode 100644 src/index/txospenderindex.cpp delete mode 100644 src/index/txospenderindex.h delete mode 100644 src/test/blockfilter_index_tests.cpp delete mode 100644 src/test/blockfilter_tests.cpp delete mode 100644 src/test/coinstatsindex_tests.cpp delete mode 100644 src/test/data/blockfilters.json delete mode 100644 src/test/fuzz/blockfilter.cpp delete mode 100644 src/test/txindex_tests.cpp delete mode 100644 src/test/txospenderindex_tests.cpp delete mode 100644 src/test/util/blockfilter.cpp delete mode 100644 src/test/util/blockfilter.h delete mode 100755 test/functional/feature_coinstatsindex.py delete mode 100755 test/functional/feature_coinstatsindex_compatibility.py delete mode 100755 test/functional/feature_index_prune.py delete mode 100755 test/functional/p2p_blockfilters.py delete mode 100755 test/functional/rpc_getblockfilter.py delete mode 100755 test/functional/rpc_gettxspendingprevout.py delete mode 100755 test/functional/rpc_scanblocks.py delete mode 100644 test/functional/test_framework/blockfilter.py diff --git a/doc/REST-interface.md b/doc/REST-interface.md index ed46e22262bb..8f38238f60bb 100644 --- a/doc/REST-interface.md +++ b/doc/REST-interface.md @@ -33,8 +33,7 @@ Supported API Given a transaction hash: returns a transaction in binary, hex-encoded binary, or JSON formats. Responds with 404 if the transaction doesn't exist. -By default, this endpoint will only search the mempool. -To query for a confirmed transaction, enable the transaction index via "txindex=1" command line / configuration option. +This endpoint only searches the mempool. #### Blocks - `GET /rest/block/.` @@ -61,23 +60,6 @@ Returns empty if the block doesn't exist or it isn't in the active chain. *Deprecated (but not removed) since 24.0:* `GET /rest/headers//.` -#### Blockfilter Headers -`GET /rest/blockfilterheaders//.?count=` - -Given a block hash: returns amount of blockfilter headers in upward -direction for the filter type . -Returns empty if the block doesn't exist or it isn't in the active chain. - -*Deprecated (but not removed) since 24.0:* -`GET /rest/blockfilterheaders///.` - -#### Blockfilters -`GET /rest/blockfilter//.` - -Given a block hash: returns the block filter of the given block of type -. -Responds with 404 if the block doesn't exist. - #### Blockhash by height `GET /rest/blockhashbyheight/.` diff --git a/doc/bips.md b/doc/bips.md index eb35ca2d6ac0..03ddf085cc02 100644 --- a/doc/bips.md +++ b/doc/bips.md @@ -38,8 +38,6 @@ BIPs that are implemented by Bitcoin Core: * [`BIP 147`](https://github.com/bitcoin/bips/blob/master/bip-0147.mediawiki): NULLDUMMY softfork as of **v0.13.1** ([PR 8636](https://github.com/bitcoin/bitcoin/pull/8636) and [PR 8937](https://github.com/bitcoin/bitcoin/pull/8937)), *buried* since **v0.19.0** ([PR #16060](https://github.com/bitcoin/bitcoin/pull/16060)). * [`BIP 152`](https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki): Compact block transfer and related optimizations are used as of **v0.13.0** ([PR 8068](https://github.com/bitcoin/bitcoin/pull/8068)). * [`BIP 155`](https://github.com/bitcoin/bips/blob/master/bip-0155.mediawiki): The 'addrv2' and 'sendaddrv2' messages which enable relay of Tor V3 addresses (and other networks) are supported as of **v0.21.0** ([PR 19954](https://github.com/bitcoin/bitcoin/pull/19954)). -* [`BIP 157`](https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki) - [`158`](https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki): Compact Block Filters for Light Clients can be indexed as of **v0.19.0** ([PR #14121](https://github.com/bitcoin/bitcoin/pull/14121)) and served to peers on the P2P network as of **v0.21.0** ([PR #16442](https://github.com/bitcoin/bitcoin/pull/16442)). * [`BIP 159`](https://github.com/bitcoin/bips/blob/master/bip-0159.mediawiki): The `NODE_NETWORK_LIMITED` service bit is signalled as of **v0.16.0** ([PR 11740](https://github.com/bitcoin/bitcoin/pull/11740)), and such nodes are connected to as of **v0.17.0** ([PR 10387](https://github.com/bitcoin/bitcoin/pull/10387)). * [`BIP 173`](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki): Bech32 addresses for native Segregated Witness outputs are supported as of **v0.16.0** ([PR 11167](https://github.com/bitcoin/bitcoin/pull/11167)). Bech32 addresses are generated by default as of **v0.20.0** ([PR 16884](https://github.com/bitcoin/bitcoin/pull/16884)). * [`BIP 324`](https://github.com/bitcoin/bips/blob/master/bip-0324.mediawiki): The v2 transport protocol specified by BIP324 and the associated `NODE_P2P_V2` service bit are supported as of **v26.0**, but off by default ([PR 28331](https://github.com/bitcoin/bitcoin/pull/28331)). On by default as of **v27.0** ([PR 29347](https://github.com/bitcoin/bitcoin/pull/29347)). diff --git a/doc/developer-notes.md b/doc/developer-notes.md index fdd6824e1f73..edd0e940105d 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -695,9 +695,6 @@ done by the components. - [HTTP worker threads (`b-http_pool_x`)](https://doxygen.bitcoincore.org/httpserver_8cpp.html#a2ad0a49dc9b5e8117c0dee98c24187d8) : Threads to service RPC and REST requests. -- [Indexer threads (`b-txindex`, etc)](https://doxygen.bitcoincore.org/class_base_index.html#a96a7407421fbf877509248bbe64f8d87) - : One thread per indexer. - - [SchedulerThread (`b-scheduler`)](https://doxygen.bitcoincore.org/class_c_scheduler.html#a14d2800815da93577858ea078aed1fba) : Does asynchronous background tasks like dumping addrman and running asynchronous validationinterface callbacks. diff --git a/doc/files.md b/doc/files.md index e3f4f1b4e1b0..760e2664bc47 100644 --- a/doc/files.md +++ b/doc/files.md @@ -46,11 +46,6 @@ Subdirectory | File(s) | Description `blocks/` | `revNNNNN.dat`[\[2\]](#note2) | Block undo data (custom format) `blocks/` | `xor.dat` | Rolling XOR pattern for block and undo data files `chainstate/` | LevelDB database | Blockchain state (a compact representation of all currently unspent transaction outputs (UTXOs) and metadata about the transactions they are from) -`indexes/txindex/` | LevelDB database | Transaction index; *optional*, used if `-txindex=1` -`indexes/txospenderindex/` | LevelDB database | Transaction spender index; *optional*, used if `-txospenderindex=1` -`indexes/blockfilter/basic/db/` | LevelDB database | Blockfilter index LevelDB database for the basic filtertype; *optional*, used if `-blockfilterindex=basic` -`indexes/blockfilter/basic/` | `fltrNNNNN.dat`[\[2\]](#note2) | Blockfilter index filters for the basic filtertype; *optional*, used if `-blockfilterindex=basic` -`indexes/coinstatsindex/db/` | LevelDB database | Coinstats index; *optional*, used if `-coinstatsindex=1` `./` | `anchors.dat` | Anchor IP address database, created on shutdown and deleted at startup. Anchors are last known outgoing block-relay-only peers that are tried to re-connect to on startup `./` | `banlist.json` | Stores the addresses/subnets of banned nodes. `./` | `bitcoin.conf` | User-defined [configuration settings](bitcoin-conf.md) for `bitcoind`. File is not written to by the software and must be created manually. Path can be specified by `-conf` option diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 67ec63c18940..ed4d9d83ddb6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -158,7 +158,6 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL banman.cpp bip324.cpp blockencodings.cpp - blockfilter.cpp consensus/tx_verify.cpp dbwrapper.cpp deploymentstatus.cpp @@ -167,11 +166,6 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL httprpc.cpp httpserver.cpp i2p.cpp - index/base.cpp - index/blockfilterindex.cpp - index/coinstatsindex.cpp - index/txindex.cpp - index/txospenderindex.cpp init.cpp kernel/chain.cpp kernel/checks.cpp diff --git a/src/bench/CMakeLists.txt b/src/bench/CMakeLists.txt index 9bb0cc886f12..f930702a7038 100644 --- a/src/bench/CMakeLists.txt +++ b/src/bench/CMakeLists.txt @@ -26,9 +26,7 @@ add_executable(bench_bitcoin duplicate_inputs.cpp ellswift.cpp examples.cpp - gcs_filter.cpp hashpadding.cpp - index_blockfilter.cpp load_external.cpp lockedpool.cpp logging.cpp diff --git a/src/bench/gcs_filter.cpp b/src/bench/gcs_filter.cpp deleted file mode 100644 index ea48592ac8fc..000000000000 --- a/src/bench/gcs_filter.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2018-present The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include -#include -#include - -#include -#include -#include - -static GCSFilter::ElementSet GenerateGCSTestElements() -{ - GCSFilter::ElementSet elements; - - // Testing the benchmarks with different number of elements show that a filter - // with at least 100,000 elements results in benchmarks that have the same - // ns/op. This makes it easy to reason about how long (in nanoseconds) a single - // filter element takes to process. - for (int i = 0; i < 100000; ++i) { - GCSFilter::Element element(32); - element[0] = static_cast(i); - element[1] = static_cast(i >> 8); - elements.insert(std::move(element)); - } - - return elements; -} - -static void GCSBlockFilterGetHash(benchmark::Bench& bench) -{ - auto elements = GenerateGCSTestElements(); - - GCSFilter filter({0, 0, BASIC_FILTER_P, BASIC_FILTER_M}, elements); - BlockFilter block_filter(BlockFilterType::BASIC, {}, filter.GetEncoded(), /*skip_decode_check=*/false); - - bench.run([&] { - block_filter.GetHash(); - }); -} - -static void GCSFilterConstruct(benchmark::Bench& bench) -{ - auto elements = GenerateGCSTestElements(); - - uint64_t siphash_k0 = 0; - bench.run([&]{ - GCSFilter filter({siphash_k0, 0, BASIC_FILTER_P, BASIC_FILTER_M}, elements); - - siphash_k0++; - }); -} - -static void GCSFilterDecode(benchmark::Bench& bench) -{ - auto elements = GenerateGCSTestElements(); - - GCSFilter filter({0, 0, BASIC_FILTER_P, BASIC_FILTER_M}, elements); - auto encoded = filter.GetEncoded(); - - bench.run([&] { - GCSFilter filter({0, 0, BASIC_FILTER_P, BASIC_FILTER_M}, encoded, /*skip_decode_check=*/false); - }); -} - -static void GCSFilterDecodeSkipCheck(benchmark::Bench& bench) -{ - auto elements = GenerateGCSTestElements(); - - GCSFilter filter({0, 0, BASIC_FILTER_P, BASIC_FILTER_M}, elements); - auto encoded = filter.GetEncoded(); - - bench.run([&] { - GCSFilter filter({0, 0, BASIC_FILTER_P, BASIC_FILTER_M}, encoded, /*skip_decode_check=*/true); - }); -} - -static void GCSFilterMatch(benchmark::Bench& bench) -{ - auto elements = GenerateGCSTestElements(); - - GCSFilter filter({0, 0, BASIC_FILTER_P, BASIC_FILTER_M}, elements); - - bench.run([&] { - filter.Match(GCSFilter::Element()); - }); -} -BENCHMARK(GCSBlockFilterGetHash); -BENCHMARK(GCSFilterConstruct); -BENCHMARK(GCSFilterDecode); -BENCHMARK(GCSFilterDecodeSkipCheck); -BENCHMARK(GCSFilterMatch); diff --git a/src/bench/index_blockfilter.cpp b/src/bench/index_blockfilter.cpp deleted file mode 100644 index 805ad050bfcc..000000000000 --- a/src/bench/index_blockfilter.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2023-present The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or https://www.opensource.org/licenses/mit-license.php. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include