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

LocalChain changes should be monotone #1005

Open
LLFourn opened this issue Jun 15, 2023 · 2 comments
Open

LocalChain changes should be monotone #1005

LLFourn opened this issue Jun 15, 2023 · 2 comments
Labels
module-blockchain new feature New feature or request
Milestone

Comments

@LLFourn
Copy link
Contributor

LLFourn commented Jun 15, 2023

After #937 all changsets are monotone except for LocalChain. After #1002 it becomes much easier to make LocalChain monotone too. The reason you want this is so that changesets can be applied in any order. Without this the user's application has to make sure each changeset is applied to the persistence baclkend in order and so should lock the backend and the chain until it has successfully written to disk.

The approach to doing this is simple: Make it possible to insert chain data that does not necessarily connect to the existing chain when applying a changeset. Rather just make sense of each fact provided by a changeset i.e. "at this height there existed a block with this hash which was a child of a block at this height with this hash" etc. This allows LocalChain to keep track of multiple chains and have multiple tips. it only needs to index by height the longest one (with tiebreak by blockhash -- verify this claim with respect to consensus rules I think you will find this is a good enough approximation).

This doesn't need to be done before 1.0-alpha.1 but should be done before 1.0

@LLFourn LLFourn added this to the 1.0.0 milestone Jun 15, 2023
@nondiremanuel nondiremanuel removed this from the 1.0.0 milestone Jun 19, 2023
@nondiremanuel nondiremanuel moved this to Todo in BDK Jun 19, 2023
evanlinjin added a commit to evanlinjin/bdk that referenced this issue Jul 8, 2023
This logic should carry over better when we change `LocalChain` to be
monotone (bitcoindevkit#1005).
evanlinjin added a commit to evanlinjin/bdk that referenced this issue Jul 8, 2023
This logic should carry over better when we change `LocalChain` to be
monotone (bitcoindevkit#1005).
evanlinjin added a commit to evanlinjin/bdk that referenced this issue Jul 10, 2023
This logic should carry over better when we change `LocalChain` to be
monotone (bitcoindevkit#1005).
evanlinjin added a commit to evanlinjin/bdk that referenced this issue Jul 10, 2023
This logic should carry over better when we change `LocalChain` to be
monotone (bitcoindevkit#1005).
evanlinjin added a commit to evanlinjin/bdk that referenced this issue Jul 19, 2023
This logic should carry over better when we change `LocalChain` to be
monotone (bitcoindevkit#1005).
@notmandatory notmandatory added this to the 1.0.0-alpha milestone Jul 9, 2024
@notmandatory
Copy link
Member

Discussed in dev call today and this will be addressed after the alpha milestone since it can be done without affecting the bdk_wallet API.

@notmandatory notmandatory modified the milestones: 1.0.0-alpha, 1.0.0-beta Jul 9, 2024
@LLFourn
Copy link
Contributor Author

LLFourn commented Jul 12, 2024

This I think shouldn't be done in beta but rather 2.0.0. LocalChain will suffice for now and we can introduce a BlockGraph as a drop in replacement later on.

@notmandatory notmandatory modified the milestones: 1.0.0-beta, 2.0.0 Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module-blockchain new feature New feature or request
Projects
Status: Todo
Development

No branches or pull requests

3 participants