From: merge-script Date: Tue, 24 Nov 2026 09:25:23 +0000 (+0400) Subject: Merge bitcoindevkit/bdk-cli#377: fix(wallet): prevent wallet network changes and... X-Git-Url: http://internal-gitweb-vhost/-script/src/consensus/encode/scripts/enum.ParseCompressedPublicKeyError.html?a=commitdiff_plain;p=bdk-cli Merge bitcoindevkit/bdk-cli#377: fix(wallet): prevent wallet network changes and clarify mismatch errors 4b93fe62f57d29c86e2be16b80c2b1e5a4a09ec7 fix(handlers): take the network of wallet contexts from the wallet (Muawiya Abubakar) f9d16f4d12ec75ccd5c91cd38448e5294d208ee0 fix(wallet): prevent wallet network changes and clarify mismatch errors (Muawiya Abubakar) Pull request description: ### Description Wallet commands other than `wallet config` already use the network saved in `config.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 --force` without the original `--network` option. When the default `testnet` network is used, it overwrites the saved network while the database keeps the original one. This PR: 1. Prevents `wallet config --force` from changing an existing wallet's network, while still allowing updates to other settings. 2. Clarifies the wallet load error when the network in `config.toml` doesn't match the wallet database. 3. Takes the network of wallet contexts from the loaded wallet, so wallet handlers such as `create_dns_tx`, `unspent` and wallet HWI always use the wallet's network. Fixes #359 ### Notes to the reviewers * `--network` remains a top-level option. Moving it is left for separate work. * If `wallet config --force` uses the default `testnet` network for a wallet configured on another network, the command now fails instead of overwriting the saved network. * The guard checks the saved configuration, so `--force` cannot repair an existing network mismatch. * `LoadWallet` and its `From` impl are gated behind either the `sqlite` or `redb` feature because only persisted wallets load from a database. * Wallet contexts now set their network from `wallet.network()` in their constructors, so the handlers didn't need to change. * Added a `CHANGELOG.md` entry for the `wallet config --force` fix. ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk-cli/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing #### Bugfixes: * [x] I've added tests to reproduce the issue which are now passing * [x] I'm linking the issue being fixed by this PR ACKs for top commit: tvpeter: ACK 4b93fe62f57d29c86e2be16b80c2b1e5a4a09ec7 vadim-anfv: tACK 4b93fe62f57d29c86e2be16b80c2b1e5a4a09ec7; successfully ran local tests; also tested manually. Tree-SHA512: adac27fb13c614c852c200568a6e22887ed0ff6d1014f87e2c14bbee45e839d9fafd6a444e713a025d37fc557b2d8511b803edb1f91dbbfecd4a13c0ecf635d9 --- 6106144a826f92070b157bb040891674825e2940