Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tapdb: add table to track anchored altLeaves #1241

Open
1 task
jharveyb opened this issue Dec 5, 2024 · 0 comments
Open
1 task

tapdb: add table to track anchored altLeaves #1241

jharveyb opened this issue Dec 5, 2024 · 0 comments
Labels
enhancement New feature or request optimization

Comments

@jharveyb
Copy link
Contributor

jharveyb commented Dec 5, 2024

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:

// TODO(jhb): replace full proof fetch with

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]

@jharveyb jharveyb added the enhancement New feature or request label Dec 5, 2024
@jharveyb jharveyb changed the title tapdb: add table to track anchored alt leaves tapdb: add table to track anchored altLeaves Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request optimization
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants