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

Create and store block filters #89

Merged
merged 8 commits into from
Nov 21, 2023
Merged

Create and store block filters #89

merged 8 commits into from
Nov 21, 2023

Conversation

Davidson-Souza
Copy link
Collaborator

If a user wants to add a new wallet, they need to rescan from genesis to find out about the wallet's history. Downloading all blocks will incur in a lot of resource usage. This PR creates an internal filter storage that can be used during rescan.

This is not the same filter that can be downloaded from the p2p network as per BIP157. While we use the same construction as BIP158, we customize what is committed, looking for deduction in size and CPU usage. Moreover, BIP157/158 filters aren't authenticated, so misbehaving peers could, in theory, fool our wallet with an invalid filter. While in theory, this can be handled by asking for BIP157 filter headers, it adds a lot of state and round-trips that are a bit tricky to represent in floresta right now.

Currently, the filters are under the watch-only crate, we can only find blocks of interest, but not ask for such blocks, since the electrum server doesn't hold a handle to the node. I think it's fine if it does, but this needs to be implemented.

@Davidson-Souza Davidson-Souza force-pushed the block-filters branch 3 times, most recently from c21c6a8 to 29fce30 Compare November 6, 2023 19:23
@Davidson-Souza Davidson-Souza marked this pull request as ready for review November 8, 2023 16:44
@Davidson-Souza Davidson-Souza changed the title WIP: Create and store block filters Create and store block filters Nov 8, 2023
@Davidson-Souza Davidson-Souza merged commit 60da291 into master Nov 21, 2023
11 checks passed
@Davidson-Souza Davidson-Souza deleted the block-filters branch January 8, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant