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

Add Compact Block Filters Syncing #1055

Conversation

vladimirfomene
Copy link
Contributor

Description

This PR uses the Nakamoto crate to add a CBF syncing logic to BDK. This implementation doesn't create/update a LocalChain, it just updates the IndexedTxGraph. The syncing logic will do a rescan if the stop_gap condition is not met.

Notes to the reviewers

I'm still not sure what logic to implement when a reorg happens. I will love to hear your thoughts on the subject.

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

@vladimirfomene vladimirfomene self-assigned this Aug 3, 2023
@vladimirfomene vladimirfomene marked this pull request as draft August 3, 2023 11:51
This implements a structure that help us start
a Nakamoto client and watch for events like
BlockMatched, BlockDisconnected and Sync for
the scripts that we are interested in.
We also implement a ChainOracle for the
CBF client.
CBFUpdateIterator will return CBFUpdate data until the Nakamoto client
has reached the tip of the chain. At that point, the iterator will
return None.

The new method, `into_tx_graph_update`, will convert the CBFUpdate into
a TxGraph update. This method is a helper that will be necessary for
updating the TxGraph once we have a CBFUpdate.
Update into_tx_graph_update to take a Vec of tuples of
blocks and transactions as input to create a TxGraph.

Add scanning with Nakamoto client. We start by creating a list of scripts
to scan and we continue to scan the chain until we have satisfied
stop_gap condition. On each scan we get a fresh list of script to watch.
We then update the IndexedGraph and return the IndexedAdditions.
@vincenzopalazzo
Copy link

vincenzopalazzo commented Aug 7, 2023

from CI I think I should finish the cloudhead/nakamoto#145

What version of rust-bitcoin bdk is using?

@notmandatory
Copy link
Member

@vincenzopalazzo the team recently merged #1023 which updates bdk (master branch) to rust-bitcoin 0.30.0 and miniscript 0.10.0.

@vincenzopalazzo
Copy link

@notmandatory Nice, so I can finish my PR now, because #1023 was blocking me in nakamoto

@evanlinjin
Copy link
Member

Thank you for this work! Since BDK has changed significantly since then, I will close this for now. Refer to #679

@evanlinjin evanlinjin closed this Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants