Repository navigation
refactor(config): remove redundant wallet field from WalletConfigInner - #350
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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
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:
|
b5a675e to
d3ec317
Compare
vadim-anfv
left a comment
There was a problem hiding this comment.
Thanks for picking this up, @Jennycj.
I left one note inline on the new test. Happy to test once it is rebased.
`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
d3ec317 to
bc050c7
Compare
I have now rebased on master, addressed both review comments, and squashed my commits into a single signed commit. |
vadim-anfv
left a comment
There was a problem hiding this comment.
ACK bc050c7; successfully ran local tests; thanks!
Description
Removes the redundant
walletfield fromWalletConfigInner. The wallet name was being stored twice: once as the key inWalletConfig::wallets, and once inside each entry aswallet: String. Thewalletscommand'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 WalletOptsneeded to be removed because it only receives the struct. It is now replaced with a privatetry_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:
cargo fmtandcargo clippybefore committing