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] 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); }