From ce068782887e531e400d3fbd86152ce064517771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C5=91rinc?= Date: Tue, 30 Jun 2026 14:05:08 -0700 Subject: [PATCH 1/2] index: shrink txospenderindex value markers `TxoSpenderIndex` uses LevelDB values only as presence markers. `FindSpender` iterates over keys and loads the spending transaction from the disk position stored in each key. Write new entries with a zero-byte span instead of a serialized empty string, so rebuilt indexes avoid one extra byte per spender entry. Existing indexes remain readable because the lookup path does not deserialize the marker value. --- src/index/txospenderindex.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/index/txospenderindex.cpp b/src/index/txospenderindex.cpp index 3d7b56b6a95..50b9bfeb8b5 100644 --- a/src/index/txospenderindex.cpp +++ b/src/index/txospenderindex.cpp @@ -23,15 +23,17 @@ #include #include +#include #include #include #include +#include #include #include #include /* The database is used to find the spending transaction of a given utxo. - * For every input of every transaction it stores a key that is a pair(siphash(input outpoint), transaction location on disk) and an empty value. + * For every input of every transaction it stores a key that is a pair(siphash(input outpoint), transaction location on disk) and a zero-byte value. * To find the spending transaction of an outpoint, we perform a range query on siphash(outpoint), and for each returned key load the transaction * and return it if it does spend the provided outpoint. */ @@ -91,8 +93,9 @@ void TxoSpenderIndex::WriteSpenderInfos(const std::vector{}); } m_db->WriteBatch(batch); } From 113402286ea305a2f0c0c0712452d424113899f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C5=91rinc?= Date: Tue, 30 Jun 2026 14:05:23 -0700 Subject: [PATCH 2/2] doc: add txospenderindex release note Document that newly indexed `txospenderindex` entries use less disk space and that existing indexes remain readable. Users only need to rebuild the index if they want previously indexed entries rewritten with the smaller marker. --- doc/release-notes-35634.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 doc/release-notes-35634.md diff --git a/doc/release-notes-35634.md b/doc/release-notes-35634.md new file mode 100644 index 00000000000..ccbd7fd7c22 --- /dev/null +++ b/doc/release-notes-35634.md @@ -0,0 +1,9 @@ +Indexes +------- + +- The transaction output spender index (`-txospenderindex`) now stores one byte + less per spender entry for newly indexed blocks. Existing indexes remain + compatible and no action is required. To apply the same saving to entries + indexed before upgrading, stop the node, delete the + `/indexes/txospenderindex/` directory, and restart with + `-txospenderindex` enabled to rebuild it.