Multiple wallet syncing#152
Merged
rustaceanrob merged 5 commits intobitcoindevkit:masterfrom Mar 13, 2026
Merged
Conversation
2869837 to
947d0fa
Compare
947d0fa to
1e5a9cf
Compare
This commit implements the scaffolding such that the `UpdateSubscriber` may handle either a single wallet or multiple wallets. The methods available on the subscriber should change depending on the configuration, but the syncing logic should remain the same. The restriction is implemented here.
If there are multiple wallets configured, this commit updates each of them via the `UpdateBuilder`. Each update is indexed on the `DescriptorId` of the public descriptor for the external keychain. These should be unique per wallet if I understand correctly.
Implements a way to create the `UpdateSubscriber<Multiple>`. Here we need to take the lowest configured checkpoint for the scan. While this is a _rescan_ for most wallets in the list, we will need to scan these filters anyway for new wallets, and the `Wallet` should handle redundant updates anyway.
Demonstrates the new API for users
This test takes the first wallet to a stale block, then shuts down the node. A new wallet is introduced, and we assert that the first wallet still detects and applies the reorganization.
1e5a9cf to
e246909
Compare
Collaborator
Author
|
Got some live feedback and I think this is good to go. The |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Closes #150 and #147
When there was a first attempt at syncing two wallets, the chain information reported from the node was insufficient; however, in the latest releases each wallet should have sufficient information to reconcile changes to the local chain. This PR uses the same typestate trick to have two APIs with shared syncing logic. Either the user will use the light client with a single wallet, in which case they can all
UpdateSubscriber::updateto receive theUpdatefor that wallet, or they need to sync multiple wallets. In the multiple wallet case, each update is indexed by theDescriptorIdfor the public, external descriptor of the wallet. TheUpdateSubscriberimplements anupdatesmethod that returns an iterator over each wallet update. Each commit has a detailed comment.The idea of #147 and similar discussion is to allow more granular access to the syncing logic, but I would like to move opposite of this direction. This API is as high-level as possible, but I believe it reflects the end use case we are going for, which is one user with potentially 3-5 descriptors that they want to sync simultaneously.
cc @thunderbiscuit