Read walletdir from bitcoin.conf when deleting wallet files#2594
Open
Copilot wants to merge 5 commits into
Open
Read walletdir from bitcoin.conf when deleting wallet files#2594Copilot wants to merge 5 commits into
walletdir from bitcoin.conf when deleting wallet files#2594Copilot wants to merge 5 commits into
Conversation
✅ Deploy Preview for specter-desktop-docs canceled.
|
Copilot
AI
changed the title
[WIP] Fix wallets directory detection and removal
Read Apr 8, 2026
walletdir from bitcoin.conf when deleting wallet files
k9ert
approved these changes
Apr 8, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes wallet file deletion when Bitcoin Core is configured with a custom walletdir in bitcoin.conf, by resolving the effective wallet base directory (network section overrides defaults) and using it during delete operations.
Changes:
- Add
get_walletdir(datadir, chain)helper to readwalletdirfrom parsedbitcoin.confwith network-specific precedence. - Update wallet deletion logic to use
walletdirwhen present, falling back to previous datadir-based paths when absent. - Add test coverage and fixtures for
walletdirinbitcoin.conf.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_rpc.py | Adds unit tests for get_walletdir behavior (default vs network override). |
| tests/misc_testdata/rpc_autodetection/example_walletdir_network/bitcoin.conf | New fixture with both global and [regtest] walletdir. |
| tests/misc_testdata/rpc_autodetection/example_walletdir_default/bitcoin.conf | New fixture with only global walletdir. |
| src/cryptoadvance/specter/rpc.py | Introduces get_walletdir() using get_rpcconfig() output. |
| src/cryptoadvance/specter/node.py | Uses get_walletdir() in Node.delete_wallet_file() to locate wallet files correctly. |
| src/cryptoadvance/specter/devices/bitcoin_core.py | Uses get_walletdir() in BitcoinCore.delete() to locate hot-wallet files correctly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
k9ert
approved these changes
Apr 8, 2026
k9ert
approved these changes
Apr 9, 2026
Agent-Logs-Url: https://github.com/cryptoadvance/specter-desktop/sessions/c4ca2589-ea03-4b41-bb0f-755e6e01ad4e Co-authored-by: k9ert <117085+k9ert@users.noreply.github.com>
Agent-Logs-Url: https://github.com/cryptoadvance/specter-desktop/sessions/c4ca2589-ea03-4b41-bb0f-755e6e01ad4e Co-authored-by: k9ert <117085+k9ert@users.noreply.github.com>
…ilde tests Agent-Logs-Url: https://github.com/cryptoadvance/specter-desktop/sessions/4090310e-e091-40d1-adb6-4dd549c76332 Co-authored-by: k9ert <117085+k9ert@users.noreply.github.com>
Agent-Logs-Url: https://github.com/cryptoadvance/specter-desktop/sessions/376d87d6-b9af-4e58-ba3f-c005f1689cce Co-authored-by: k9ert <117085+k9ert@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
cf75983 to
9c9b41e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Specter hardcoded the wallet directory as
datadir + /wallets/(or chain-specific subdir), ignoring thewalletdiroption inbitcoin.conf. This causes wallet file deletion to silently fail for any node using a custom wallet directory.Changes
rpc.py— Newget_walletdir(datadir, chain)helper: callsget_rpcconfig()and returns the configuredwalletdir, with the network-specific section (e.g.[regtest]) taking precedence over[default]. ReturnsNoneif unset.node.py—Node.delete_wallet_file()— Usesget_walletdir()as the wallet base path when set; falls back to existingdatadir + chain-subdirlogic otherwise.devices/bitcoin_core.py—BitcoinCore.delete()— Same pattern;walletdirreplaces the two-candidate path search when configured.Example
bitcoin.confpatterns handledAll three formats are already parsed by
get_rpcconfig(), so no parser changes were needed.