btcwallet: add ImportAccountRescan#1184
Open
losh11 wants to merge 2 commits into
Open
Conversation
Collaborator
|
Thanks for the PR - just FYI the repo is undergoing a major change, including the rescanning and all the public APIs due to sqlization of the db, for more info check the milestone. |
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.
Change Description
Adds account-aware recovery code to support rescanning historical transactions for imported watch-only accounts. Used by LND WalletKit's
ImportAccount.Currently, ImportAccount creates a watch-only account from an extended public key but cannot detect transactions that occurred before the import. The existing recovery system (used for seed restore) performs gap-limit-based address discovery via FilterBlocks, but is hardcoded to DefaultAccountNum. This PR makes the recovery system account-parameterized so it can be used for any account, and adds ImportAccountWithRescan which imports an account and launches a background recovery scan from a caller-specified birthday height.
This is backend-agnostic — it uses chain.Interface.FilterBlocks() which is implemented by all backends (neutrino, btcd, bitcoind).
A companion PR to lnd will wire these new methods into the ImportAccount RPC by adding birthday_height and recovery_window request fields, allowing users to trigger a historical rescan when importing an account.
Example usage:
Steps to Test
Pull Request Checklist
Testing
Code Style and Documentation