Skip to content

refactor(config): remove redundant wallet field from WalletConfigInner - #350

Merged
tvpeter merged 1 commit into
bitcoindevkit:masterfrom
Jennycj:refactor/remove-wallet-config-field
Oct 27, 2026
Merged

tvpeter merged 1 commit into
bitcoindevkit:masterfrom
Jennycj:refactor/remove-wallet-config-field

Conversation

@Jennycj

@Jennycj Jennycj commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

Removes the redundant wallet field from WalletConfigInner. The wallet name was being stored twice: once as the key in WalletConfig::wallets, and once inside each entry as wallet: String. The wallets command's JSON/TOML output showed both.
For example:

{
  "my_wallet": {
    "wallet": "my_wallet",
    "network": "testnet",
    ...
  }
}

The "wallet" field inside the entry is gone and the name is still available as the map key.

Fixes #332

Notes to the reviewers

  • TryFrom<&WalletConfigInner> for WalletOpts needed to be removed because it only receives the struct. It is now replaced with a private try_to_wallet_opts(&self, wallet_name: &str) that takes the name from the caller instead.

  • Backward compatible: old config.toml files with the stray wallet = "..." line still load (serde ignores unknown fields). This is covered bytest_load_tolerates_legacy_wallet_field.

  • CHANGELOG updated under [Unreleased].

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.83%. Comparing base (4445a26) to head (bc050c7).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #350      +/-   ##
==========================================
+ Coverage   58.74%   58.83%   +0.08%     
==========================================
  Files          25       25              
  Lines        4608     4618      +10     
==========================================
+ Hits         2707     2717      +10     
  Misses       1901     1901              
Flag Coverage Δ
rust 58.83% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Jennycj
Jennycj force-pushed the refactor/remove-wallet-config-field branch from b5a675e to d3ec317 Compare October 20, 2026 10:35

@vadim-anfv vadim-anfv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up, @Jennycj.
I left one note inline on the new test. Happy to test once it is rebased.

Comment thread tests/integration/init.rs Outdated

@tvpeter tvpeter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Jennycj for working on this.

A few quick things before we merge:

  • Please rebase as #312 introduced updates to the wallets command.
  • Address Vadim's feedback regarding the test comment.
  • Squash your commits to a single commit.

Comment thread src/config.rs Outdated
`WalletConfigInner` duplicated its own wallet name in a `wallet` field,
even though it's already the key in `WalletConfig::wallets` - this
showed up as a redundant `"wallet"` entry in `wallets list` output.

`TryFrom<&WalletConfigInner> for WalletOpts` relied on that field, so
it's replaced with a private `to_wallet_opts(&self, wallet_name: &str)`
that takes the name from the caller's map lookup instead. Old config.toml
files still load fine; serde ignores the now-unknown `wallet` key.

Fixes bitcoindevkit#332
@Jennycj
Jennycj force-pushed the refactor/remove-wallet-config-field branch from d3ec317 to bc050c7 Compare October 25, 2026 22:55
@Jennycj

Jennycj commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Thank you @Jennycj for working on this.

A few quick things before we merge:

I have now rebased on master, addressed both review comments, and squashed my commits into a single signed commit.

@tvpeter tvpeter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK bc050c7

@vadim-anfv vadim-anfv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK bc050c7; successfully ran local tests; thanks!

@tvpeter
tvpeter merged commit 80bb873 into bitcoindevkit:master Oct 27, 2026
10 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in BDK-CLI Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Remove "wallet" field from WalletConfigInner

3 participants