Rescanning the blockchain can take some time. How can I tell (via RPC) when the rescanblockchain command has finished? Will it block until it's done, and only then return? Or is there another RPC I can use to see its progress?

Does the same answer apply to other RPC calls that might trigger a rescan, such as importmulti and loadwallet?

I'm worried about (if it blocks) the user experience of sitting there for possibly minutes with no progress indication; or (if it doesn't block) future RPC calls (such as getbalance) getting stale info before the rescan has completed.


rescanblockchain will block until it is complete. This will happen for any RPC which rescans the blockchain.

However, this does not mean that the RPC interface is unusable. You can still interact with it from another thread. If a rescan is taking too long, you can use abortrescan from another thread/process (e.g. another terminal session) to cancel the ongoing rescan.

There are no RPCs for seeing the progress of a rescan. However, if you are using bitcoin-qt, a dialog window will appear with a progress bar showing the rescan progress.

| improve this answer | |
  • What happens if the blockchain has been purged? Will it re-download the necessary blocks, and if so, will the RPC block until that's all done? (Could take days...) What happens if bitcoind is shutdown or killed in the middle of a rescan? Is there any indication that it did not complete successfully? – Bitcoin Hodler Dec 30 '18 at 3:18
  • 1
    bitcoind will give you an error if you are trying to rescan blocks that have been pruned. It will not scan at all. If bitcoind is shutdown or crashes, the rescan will be aborted and not continued when started later. There is rescan information that is logged to the debug.log file, including when it started, it's progress, whether it was aborted or completed, and why it was aborted. – Andrew Chow Dec 30 '18 at 17:26
  • As you correctly interpreted, I meant pruned, not purged. – Bitcoin Hodler Dec 30 '18 at 17:54
  • Starting in v0.19, getwalletinfo will report the scan progress via RPC. Yay! – Bitcoin Hodler May 6 '19 at 15:48

Look at the debug.log file.

For example, by running this in a terminal:

tail -f ~/.bitcoin/debug.log
| improve this answer | |
  • The question is about how to tell via RPC, not interactively in a terminal window. – Bitcoin Hodler Apr 3 '19 at 4:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.