Implement linked-list LocalChain and update chain-src crates/examples#1034
Merged
evanlinjin merged 8 commits intobitcoindevkit:masterfrom Aug 3, 2023
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #997
Replaces #1002
Description
This PR changes the
LocalChainimplementation to have blocks stored as a linked-list. This allows the data-src thread to hold a shared ref to a single checkpoint and have access to the whole history of checkpoints without cloning or keeping a lock onLocalChain.The APIs of
bdk::Wallet,esploraandelectrumare also updated to reflect these changes. Note that theesploracrate is rewritten to anchor txs in the confirmation block (using the esplora API's tx status block_hash). This guarantees 100% consistency between anchor blocks and their transactions (instead of anchoring txs to the latest tip).ExploraExtnow has separate methods for updating theTxGraphandLocalChain.A new method
TxGraph::missing_blocksis introduced for finding "floating anchors" of aTxGraphupdate (given a chain).Additional changes:
test_local_chain.rsis refactored to make test cases easier to write. Additional tests are also added.*.dbfiles in.gitignore.bdk_tmp_planmodule.Notes to the reviewers
This is the smallest possible division of #1002 without resulting in PRs that do not compile. Since we have changed the API of
LocalChain, we also need to changeesplora,electrumcrates and examples alongsidebdk::Wallet.Changelog notice
LocalChain. This allows the data-src thread to hold a shared ref to a single checkpoint and have access to the whole history of checkpoints without cloning or keeping a lock onLocalChain.esplorachain-src crate to anchor txs to their confirmation blocks (using esplora API's tx-statusblock_hash).Checklists
All Submissions:
cargo fmtandcargo clippybefore committingNew Features: