"Close wallet" says nothing about pruning: a wallet left closed on a pruned node can later not be opened without re-downloading the chain #1127

Open
opened 2026-11-13 15:11:43 +00:00 by jarolrod · 0 comments
jarolrod commented 2026-11-13 15:11:43 +00:00 (Migrated from github.com)

The Close wallet confirmation says only Do you want to close the wallet "<name>"?. On a pruned node, a wallet that stays closed while the node connects more blocks than it keeps cannot be opened again without re-downloading the chain, and the app does not say so beforehand. Bitcoin-Qt's confirmation carries that warning.

To reproduce, on a regtest node started with -prune=1 -fastprune:

  1. With wallets savings and daily open, open the wallet picker, choose … on the savings row, then Close wallet, and confirm.
  2. Mine 700 blocks and prune past the block where savings was closed (pruneblockchain; the wallet was closed at height 103 and pruneheight became 504).
  3. Click savings in the picker.

A popup says "Failed to open wallet" with Core's text "Wallet loading failed. Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of a pruned node)", and the row turns red. loadwallet returns error -4 with the same sentence.

Case Result
savings, closed from the row menu Fails to open, 3 of 3 attempts, and again after a restart
spare, closed with File → Close Wallet… Fails to open, 1 of 1
daily, left open through the same blocks and prune Unaffected, at the tip
savings closed and reopened at once Opens
Same steps without pruning savings reopens after the 700 blocks
bitcoind alone: unload, 700 blocks, prune past it Error -4 with the same sentence, also after a restart

The refusal is Core's and correct, and nothing is lost: the wallet file is intact and loads on a node that has the blocks. What is missing is the sentence before the fact. This is the whole popup:

github.com/bitcoin-core/gui-qml@2bd5a61e83/qml/pages/wallet/DesktopWallets.qml (L586-L606)

Bitcoin-Qt adds, by its source (walletcontroller.cpp#L94-L95): "Closing the wallet for too long can result in having to resync the entire chain if pruning is enabled."

With the app's reduced-storage default (2 GB, saved as prune=1907) the node keeps about a week of blocks on mainnet, or about 3 days if every block were full. That is arithmetic from Core's source and assumed block sizes, not a measurement. What counts is the blocks connected while the wallet is not loaded.

Closed #574 listed "Include pruning/resync warning text when appropriate for the selected release behavior". #727 added the confirmation and closed it. I found no discussion of the sentence there, and it was never in the QML.

Suggested: add the pruning sentence to the confirmation, at least when the node is pruned. Optionally, when a load fails with this error, say that the wallet file is intact; today the only instruction on screen is a command-line option the app has no control for. Related: the restore case on #947, and the storage texts in #1075 and #1050.

Reproduced on qt6 at 2bd5a61e8304, macOS arm64 / Qt 6.9.0, isolated regtest, offscreen and native, and offscreen at eed1f426fcb6. Limits:

  • Wallets, payments, blocks and the prune came over RPC. Pruning was manual (pruneblockchain), standing in for the automatic pruning of a 2 GB node.
  • Clicks went through the test bridge. File → Close Wallet… was triggered through its action, not the native menu bar.
  • Bitcoin-Qt was read, not run. The mainnet first-run default was read from the source, not run.
The **Close wallet** confirmation says only `Do you want to close the wallet "<name>"?`. On a pruned node, a wallet that stays closed while the node connects more blocks than it keeps cannot be opened again without re-downloading the chain, and the app does not say so beforehand. Bitcoin-Qt's confirmation carries that warning. To reproduce, on a regtest node started with `-prune=1 -fastprune`: 1. With wallets `savings` and `daily` open, open the wallet picker, choose **…** on the `savings` row, then **Close wallet**, and confirm. 2. Mine 700 blocks and prune past the block where `savings` was closed (`pruneblockchain`; the wallet was closed at height 103 and `pruneheight` became 504). 3. Click `savings` in the picker. A popup says "Failed to open wallet" with Core's text "Wallet loading failed. Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of a pruned node)", and the row turns red. `loadwallet` returns error -4 with the same sentence. | Case | Result | |---|---| | `savings`, closed from the row menu | Fails to open, 3 of 3 attempts, and again after a restart | | `spare`, closed with File → Close Wallet… | Fails to open, 1 of 1 | | `daily`, left open through the same blocks and prune | Unaffected, at the tip | | `savings` closed and reopened at once | Opens | | Same steps without pruning | `savings` reopens after the 700 blocks | | `bitcoind` alone: unload, 700 blocks, prune past it | Error -4 with the same sentence, also after a restart | The refusal is Core's and correct, and nothing is lost: the wallet file is intact and loads on a node that has the blocks. What is missing is the sentence before the fact. This is the whole popup: https://github.com/bitcoin-core/gui-qml/blob/2bd5a61e8304d5143e32f1ce977a2de2aceb6413/qml/pages/wallet/DesktopWallets.qml#L586-L606 Bitcoin-Qt adds, by its source ([walletcontroller.cpp#L94-L95](https://github.com/bitcoin/bitcoin/blob/44901d8f64cb617714707bd025ecd83f108353c2/src/qt/walletcontroller.cpp#L94-L95)): "Closing the wallet for too long can result in having to resync the entire chain if pruning is enabled." With the app's reduced-storage default (2 GB, saved as `prune=1907`) the node keeps about a week of blocks on mainnet, or about 3 days if every block were full. That is arithmetic from Core's source and assumed block sizes, not a measurement. What counts is the blocks connected while the wallet is not loaded. Closed #574 listed "Include pruning/resync warning text when appropriate for the selected release behavior". #727 added the confirmation and closed it. I found no discussion of the sentence there, and it was never in the QML. Suggested: add the pruning sentence to the confirmation, at least when the node is pruned. Optionally, when a load fails with this error, say that the wallet file is intact; today the only instruction on screen is a command-line option the app has no control for. Related: the restore case on #947, and the storage texts in #1075 and #1050. Reproduced on `qt6` at `2bd5a61e8304`, macOS arm64 / Qt 6.9.0, isolated regtest, offscreen and native, and offscreen at `eed1f426fcb6`. Limits: - Wallets, payments, blocks and the prune came over RPC. Pruning was manual (`pruneblockchain`), standing in for the automatic pruning of a 2 GB node. - Clicks went through the test bridge. File → Close Wallet… was triggered through its action, not the native menu bar. - Bitcoin-Qt was read, not run. The mainnet first-run default was read from the source, not run.
Sign in to join this conversation.
No description provided.