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

Better address setup #372

Closed
afilini opened this issue Jun 17, 2021 · 4 comments
Closed

Better address setup #372

afilini opened this issue Jun 17, 2021 · 4 comments
Assignees
Labels
module-blockchain module-database new feature New feature or request summer-of-bitcoin Summer of Bitcoin Project Proposal

Comments

@afilini
Copy link
Member

afilini commented Jun 17, 2021

Description

Instead of using the derivation index we should store for each address whether or not it has been "setup" with the blockchain backend. We could merge Blockchain::setup() with Blockchain::sync() and just let the function decide what to do with each address based on its status.

Probably depends on #359 since we would have to change the db interface.

Expected Outcomes

  • Update blockchain module traits and structs as needed and fix corresponding tests
  • Add add or combine tests if needed to cover updated functionality
  • Update any modified public traits and structs documentation

Resources

Skills Required

Mentor(s)
@notmandatory

Difficulty
Medium

Competency Test

  • Install rust, compile and run all bdk examples and tests.
  • Read through the BDK docs.
  • Make a dummy wallet with BDK with key-value and sqlite backends.
  • Familiarity with basic rust, should be able to write basic custom trait implementations on foreign structures.
@notmandatory
Copy link
Member

Per our team chat yesterday I changed this into a summer-of-bitcoin project.

@LLFourn
Copy link
Contributor

LLFourn commented Dec 20, 2021

I think this one needs to be expanded up on since I don't know what I would do with it if I had to tackle it. In particular I'm not totally clear on the motivation and what the result should look like.

@notmandatory
Copy link
Member

The genesis of this issue is #354.

My understanding is when addresses are requested (ie. get_address) prior to a sync and then setup isn't called. But by keeping track on individual addresses if they're setup or not at least the first part of #354 is solved since they can be setup if needed every time sync is called.

In my mind this change will create a table for all get_address scripts generated (or at least their indexes) with a boolean indicating if they are "setup" or not. Then when sync is called a query will be done to find any not-setup scripts, and if any are found call setup on them. I think the reason to not setup each script as it's requested is that it would be a performance hit. Also we allow random indexes to be requested so keeping only a range of index not setup wouldn't work.

But maybe there's a better way to address the two issues from #354 and we can explore that with whoever takes this on.

@notmandatory
Copy link
Member

Closing this issue since sync/scan works differently now with the bdk_chain crate in v1.0.0.

@github-project-automation github-project-automation bot moved this from Todo to Done in BDK Maintenance Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module-blockchain module-database new feature New feature or request summer-of-bitcoin Summer of Bitcoin Project Proposal
Projects
Status: Done
Development

No branches or pull requests

3 participants