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

Trigger wallet rescan on wallet import/restore #1589

Closed
windsok opened this issue Feb 8, 2023 · 5 comments · Fixed by #4041
Closed

Trigger wallet rescan on wallet import/restore #1589

windsok opened this issue Feb 8, 2023 · 5 comments · Fixed by #4041

Comments

@windsok
Copy link
Contributor

windsok commented Feb 8, 2023

One user reported that after importing a wallet they originally created with Sparrow, ord was not showing any of the inscriptions they had received to the wallet. To fix the issue they initiated a manual rescan with rescanblockchain using bitcoin-cli.

Not sure if they did something weird when restoring the wallet, or if we need to add some logic to automatically trigger a rescan in bitcoin core when wallets are imported.

@windsok windsok changed the title Trigger rescan on wallet import/restore Trigger wallet rescan on wallet import/restore Feb 8, 2023
@casey
Copy link
Collaborator

casey commented Feb 8, 2023

Hmmm, interesting. If they ran ord wallet restore, and their outputs didn't show up, then we should look into that. If they imported descriptors manually, then maybe we can make sure the wallet is synced?

@raphjaph added a Wallet struct, and we can perform any initialization of the wallet, like making sure it's loaded and synced.

casey@a9f9e70

@raphjaph
Copy link
Collaborator

raphjaph commented Feb 8, 2023

Rescans can take quite a while so would be hesitant to call rescanblockchain for every wallet command. So probably own command or only on ord wallet restore.

@windsok
Copy link
Contributor Author

windsok commented Feb 9, 2023

We can limit the rescan to start from the block containing the genesis inscription - 767340

I did a test restore and rescan and it took 51 seconds on my machine. This will obviously get slower as the chain get's longer though.

This was referenced Feb 16, 2023
@andrewtoth
Copy link
Contributor

I think the latest Bitcoin core release also uses compact block filters for rescanning. So if a user has blockfilterindex=1 and we start from first inscription height it will likely be single digit seconds.

@kaloudis
Copy link

I had a wallet I restored that received inscriptions about a year ago.

When I restored it into ord, the Bitcoin Core logs returned that it has only rescanned back 23 blocks:
[ord] RescanFromTime: Rescanning last 23 blocks

To remedy I had to kick off a manual rescan on the wallet:
bitcoin-cli -rpcwallet=ord rescanblockchain 767430

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 a pull request may close this issue.

5 participants