<p>The wallet needs access to the chainstate for normal operation, and that needs access to the block index. So the wallet requires a chainstate in its constructor, and the object managing the chainstate is not available until after the block index has been loaded and the sanity checks completed. There are several places within the wallet which assume that the chainstate is available.</p>
<p>Additionally, there are many RPCs which need access to the chainstate and other node objects, and the general assumption with these RPCs is that those objects are available (they tend to be globals). So to avoid any issues with objects not being initialized yet, the RPC server will block all RPC calls until initialization is complete so that those objects are guaranteed to be initialized.</p>
<p>This probably could be changed to not block, however such a project would be likely be pretty big and require significant changes to the assumptions around global objects. As with all open source projects, the reason this has not been done is because no one has bothered to do it.</p>

CC BY-SA 4.0
2022-02-14T16:35:07.603Z
2022-02-14T16:35:07.603Z
Ava Chow
<p>Why can't Core CLI query wallet balance until having loaded block index and verified blocks? It takes a few moments when running the test and sig nets, but when running the main net it is tough for my ages ancient hardware and takes many seconds. Sometimes it is a bit inconvenient. Shouldn't both <em>loads</em> be parallel?</p>

<bitcoin-core><wallet><bitcoind><bitcoin-cli>
Why can't Core CLI query wallet balance when loading block index or verifying blocks?
Mercedes
# Why can't Core CLI query wallet balance when loading block index or verifying blocks?

(Asked by: username_0 on 2022-02-11)

Why can't Core CLI query wallet balance until having loaded block index and verified blocks? It takes a few moments when running the test and sig nets, but when running the main net it is tough for my ages ancient hardware and takes many seconds. Sometimes it is a bit inconvenient. Shouldn't both *loads* be parallel?

**Tags:** bitcoin-core, wallet, bitcoind, bitcoin-cli


---

## 1 answers

### Answer by username_1 on 2022-02-14. Score: 6 | Accepted answer

The wallet needs access to the chainstate for normal operation, and that needs access to the block index. So the wallet requires a chainstate in its constructor, and the object managing the chainstate is not available until after the block index has been loaded and the sanity checks completed. There are several places within the wallet which assume that the chainstate is available.

Additionally, there are many RPCs which need access to the chainstate and other node objects, and the general assumption with these RPCs is that those objects are available (they tend to be globals). So to avoid any issues with objects not being initialized yet, the RPC server will block all RPC calls until initialization is complete so that those objects are guaranteed to be initialized.

This probably could be changed to not block, however such a project would be likely be pretty big and require significant changes to the assumptions around global objects. As with all open source projects, the reason this has not been done is because no one has bothered to do it.


---

