lightninglabs / lightninglabs/taproot-assets

tapdb: add table to track anchored altLeaves

Open
#1,241 0 comments 0 reactions 1 assignee View on GitHub

@jtobin is already working on this.

Since Jun 15, 2026.

enhancement optimization
Dominant language
Go
Stars
525
Forks
150
Avg merge
2d 15h
Merged PRs (30d)
31

Description

In #1233 , we add logic to look up the altLeaves used for an anchor input, during coin selection. This must be looked up separately from assets, since altLeaves are not stored in the assets table.

Right now this is done by fetching the whole input proof, decoding only the last proof, and then reading the altLeaves from there:

https://github.com/lightninglabs/taproot-assets/blob/f49820fd73aa850ca007df6357437b80af981294/tapdb/assets_store.go#L2171

This implementation works, but could cause performance issues as the total input proof size grows. That potential issue is something we also wouldn't detect in our itests, as-is.

Proposed Enhancement

A better option would be:

  • Add new DB table to track the outpoint -> altLeaves mapping.

Consequently, We could then look up the altLeaves directly and never decode the input proof in this DB transaction.

Since we're dealing with P2TR tx's, I think using the outpoint as the unique key for storage should be fine; it also wouldn't change in the case of re-orgs.

[edit by maintainer]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.