ord
ord copied to clipboard
Trigger wallet rescan on wallet import/restore
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.
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.
https://github.com/casey/ord/commit/a9f9e70b739a238471ee062906e7cb268e711be5
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
.
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.
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.
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