Skip to content

Witness transaction index#117

Open
Sjors wants to merge 3 commits into
masterfrom
2026/06/wtxindex
Open

Witness transaction index#117
Sjors wants to merge 3 commits into
masterfrom
2026/06/wtxindex

Conversation

@Sjors

@Sjors Sjors commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Kind of hoping we don't need this.

This uses the new encoding proposed in bitcoin#35531. Once that's merged, this PR should be rebased, and move much of the implementation to the BaseTransactionIndex class. The -txindex needs to support both encodings, while -wtxindex doesn't need to be backward compatible. The current code retains the old encoding for -txindex and only uses the new encoding for -wtxindex, so that needs to be made flexible.

100% vibe coded

Can be combined with #116, see #118.

@Sjors

Sjors commented Jun 13, 2026

Copy link
Copy Markdown
Owner Author

Rebased after bitcoin#34636

@Sjors Sjors force-pushed the 2026/06/wtxindex branch from 05c8075 to 8a532c3 Compare June 17, 2026 08:44
@Sjors

Sjors commented Jun 17, 2026

Copy link
Copy Markdown
Owner Author

Rebased after bitcoin#35173 and shortened thread name.

@Sjors Sjors force-pushed the 2026/06/wtxindex branch from 8a532c3 to d84e52a Compare June 19, 2026 13:18
@Sjors

Sjors commented Jun 19, 2026

Copy link
Copy Markdown
Owner Author

Adopted the more compact encoding from bitcoin#35531. No backward compatibility since this would be a new index.

@Sjors Sjors force-pushed the 2026/06/wtxindex branch from d84e52a to e4424b7 Compare June 19, 2026 13:52
@andrewtoth

Copy link
Copy Markdown

If we have no need for backwards compatibility, we will only be doing iterator seeks. In that case, we don't need to have bloom filters enabled on the txindex db, since only Get point reads consult the bloom filters. That should shave off some GBs and make it a little faster to index.

@Sjors

Sjors commented Jun 19, 2026

Copy link
Copy Markdown
Owner Author

If we have no need for backwards compatibility

I mean specifically for the new -wtxindex. I didn't realize there was anything bloom-filtery going on there.

@Sjors

Sjors commented Jun 19, 2026

Copy link
Copy Markdown
Owner Author

Found it, will disable that for -wtxindex in the next push.

@Sjors Sjors force-pushed the 2026/06/wtxindex branch 2 times, most recently from 9902d40 to 19b804d Compare June 25, 2026 09:27
Sjors and others added 3 commits June 25, 2026 13:51
Introduce BaseTransactionIndex and move transaction-position writing into an index-specific WriteBlock hook. Subclasses receive block context and choose how to write and match their own transaction identifiers.
Co-authored-by: Andrew Toth <andrewstoth@gmail.com>
LevelDB bloom filters are useful for exact key lookups, but compact
txindex keys are looked up with a prefix seek followed by collision
scanning.

Make BaseIndex bloom-filter use configurable so compact-key -wtxindex
can opt out while legacy -txindex keeps the existing default.

Co-authored-by: Andrew Toth <andrewstoth@gmail.com>
@Sjors Sjors force-pushed the 2026/06/wtxindex branch from 19b804d to 8f1af2e Compare June 25, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants