<p><code>rescanblockchain</code> will block until it is complete. This will happen for any RPC which rescans the blockchain.</p>
<p>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 <code>abortrescan</code> from another thread/process (e.g. another terminal session) to cancel the ongoing rescan.</p>
<p>You can use <code>getwalletinfo</code> for seeing the progress of a rescan. If you are using bitcoin-qt, a dialog window will appear with a progress bar showing the rescan progress.</p>

CC BY-SA 4.0
2018-12-30T03:18:44.257Z
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
CC BY-SA 4.0
2018-12-30T17:26:42.113Z
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.
Ava Chow
CC BY-SA 4.0
2018-12-30T17:54:40.880Z
As you correctly interpreted, I meant pruned, not purged.
Bitcoin Hodler
CC BY-SA 4.0
2019-05-06T15:48:03.460Z
Starting in v0.19, getwalletinfo will report the scan progress via RPC. Yay!
Bitcoin Hodler
CC BY-SA 4.0
2018-12-29T06:38:27.920Z
2022-11-11T10:50:11.463Z
2022-11-11T10:50:11.463Z
Ava Chow
<p>Look at the <code>debug.log</code> file.</p>

<p>For example, by running this in a terminal:</p>

<pre><code>tail -f ~/.bitcoin/debug.log
</code></pre>

CC BY-SA 4.0
2019-04-03T04:42:41.513Z
The question is about how to tell via RPC, not interactively in a terminal window.
Bitcoin Hodler
CC BY-SA 4.0
2022-02-05T18:42:31.727Z
With no way to get info by RPC, this is the best answer
Ron
CC BY-SA 4.0
2019-03-30T23:47:12.793Z
2019-03-30T23:47:12.793Z
Geremia
<p>Updated answer in from Bitcoin Core v0.19:</p>
<p>The <a href="https://developer.bitcoin.org/reference/rpc/getwalletinfo.html" rel="nofollow noreferrer"><code>getwalletinfo</code></a> RPC response contains a field <code>scanning</code> which has rescan status.</p>

CC BY-SA 4.0
2022-11-10T15:05:02.190Z
2022-11-10T15:05:51.453Z
2022-11-10T15:05:51.453Z
Alex Lloyd
<p>Rescanning the blockchain can take some time. How can I tell (via RPC) when the <code>rescanblockchain</code> 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?</p>

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

<p>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 <code>getbalance</code>) getting stale info before the rescan has completed.</p>

<bitcoin-core>
How can I tell when `rescanblockchain` is finished?
Bitcoin Hodler
# How can I tell when `rescanblockchain` is finished?

(Asked by: username_0 on 2018-12-29)

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.

**Tags:** bitcoin-core


---

## 3 answers

### Answer by username_1 on 2018-12-29. Score: 2 | Accepted answer

`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.

You can use `getwalletinfo` for seeing the progress of a rescan. If you are using username_0-qt, a dialog window will appear with a progress bar showing the rescan progress.

> **Comments:**
> **username_0**: 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?  
> **username_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.  
> **username_0**: As you correctly interpreted, I meant pruned, not purged.  
> **username_0**: Starting in v0.19, getwalletinfo will report the scan progress via RPC. Yay!  

---

### Answer by username_2 on 2019-03-30. Score: 1

Look at the `debug.log` file.

For example, by running this in a terminal:

```
tail -f ~/.username_0/debug.log

```

> **Comments:**
> **username_0**: The question is about how to tell via RPC, not interactively in a terminal window.  
> **username_3**: With no way to get info by RPC, this is the best answer  

---

### Answer by username_4 on 2022-11-10. Score: 1

Updated answer in from username_0 Core v0.19:

The [`getwalletinfo`](https://developer.username_0.org/reference/rpc/getwalletinfo.html) RPC response contains a field `scanning` which has rescan status.


---

