Repository navigation
Conversation
Wallet commands load the network saved in the wallet configuration, so --network only applies to `wallet config` and to commands that do not load a wallet, such as `key` and `descriptor`. Say so in the --network help text.
Running `wallet config --force` without the original --network saved the default network (testnet) over the existing one. The config then no longer matched the wallet database, and the wallet failed to load with a network mismatch error. - Reject a --force that would change an existing wallet network, and say which --network to pass instead - Still allow --force to update other settings on the same network - Add tests for both cases
A network mismatch between config.toml and the wallet database was wrapped in a generic error that named neither the wallet nor the file to fix. - Add a `NetworkMismatch` error naming the wallet, the network in its database and the network in config.toml, and how to fix it - Pass the wallet name to `new_persisted_wallet` - Add a test for the new error Fixes bitcoindevkit#359
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #377 +/- ##
==========================================
- Coverage 60.00% 59.69% -0.32%
==========================================
Files 25 25
Lines 4736 4573 -163
==========================================
- Hits 2842 2730 -112
+ Misses 1894 1843 -51
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Description
Wallet commands other than
wallet configalready use the network saved inconfig.toml. The mismatch happens when that network differs from the one in the wallet database.One way to reproduce this is to run
wallet config --forcewithout the original--networkoption. When the defaulttestnetnetwork is used, it overwrites the saved network while the database keeps the original one.This PR follows the approach agreed in the issue:
wallet configuse the network saved in the configuration.wallet config --forcefrom changing an existing wallet’s network, while still allowing updates to other settings.Fixes #359
Notes to the reviewers
--networkremains a top-level option. Moving it is left for separate work.wallet config --forceuses the defaulttestnetnetwork for a wallet configured on another network, the command now fails instead of overwriting the saved network.--forcecannot repair an existing network mismatch. The new error explains whichnetworkvalue to restore inconfig.toml.NetworkMismatchis gated behind either thesqliteorredbfeature because only persisted wallets can hit it.CHANGELOG.mdto cover these changes.Checklists
All Submissions:
cargo fmtandcargo clippybefore committingBugfixes: