Repository navigation
Add command to delete saved wallet config - #312
Conversation
9c25d3d to
e987877
Compare
wallets --delete to remove saved wallet config
So |
tvpeter
left a comment
There was a problem hiding this comment.
I agree with the approach of the delete operation but the returned type of WalletList is unnecesary. If returning a message is not possible, then it is better to split the wallets into something like wallets list and wallets --delete <name>. So WalletsSubcommand will be the top-level.
|
@tvpeter, that makes sense. Splitting the operations would also fix the return type issue. Just to confirm, should this become |
Yes. We both said the same thing. |
e987877 to
011390e
Compare
wallets --delete to remove saved wallet config011390e to
f2a7e8f
Compare
|
Thanks for the first review! |
vadim-anfv
left a comment
There was a problem hiding this comment.
tACK f2a7e8f
Both of my earlier comments are addressed. I can't resolve the threads myself - could you close them?
Added two non-blocking notes inline.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #312 +/- ##
==========================================
+ Coverage 57.97% 58.74% +0.77%
==========================================
Files 25 25
Lines 4490 4608 +118
==========================================
+ Hits 2603 2707 +104
- Misses 1887 1901 +14
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:
|
tvpeter
left a comment
There was a problem hiding this comment.
Thank you @yan-pi for working on this issue.
So having reconsidered the approach I suggested earlier, I think it may not be a good idea to delete saved configurations that have wallet data already persisted. So it will be better to handle it in such a way that, if the wallet data exists, return an error that wallet data exist for that configuration and do not delete the config. While it is possible to recreate the same config, the user might have lost the descriptors to do so. Also, if at all further down the line, we decide to consider deleting, it should also wipe the db file (for sqlite and much harder to even consider for redb) with a --force flag.
Aside that, kindly address the minor failing checks and review earlier by Vadim.
Thank you
|
The failing checks are unrelated to this PR. use payjoin::persist::SessionPersister as _;This file is not modified by this PR, and no Payjoin tests are executed. The default/no-default feature checks and formatting pass. |
f2a7e8f to
987c2e7
Compare
987c2e7 to
5196d96
Compare
|
Rebased onto the latest upstream/master and addressed the requested changes. I believe it’s ready for another round of review. |
vadim-anfv
left a comment
There was a problem hiding this comment.
Tested this locally and it looks good:
- an unused saved configuration is deleted, a wallet with persisted data is refused and keeps both its config entry and its data
- deleting one of two configurations leaves the other working
- deleting a name that is not in the config, and deleting with no config at all, both fail with a clear message
- redb: with two wallets in the shared store, the unused one is deleted while the store and the other wallet stay untouched
- builds clean with default features,
--no-default-featuresand--all-features
Added one small suggestion inline, on the message shown when the shared redb store cannot be opened.
The branch conflicts with master in CHANGELOG.md though, could you rebase? I already ran all of the above against this head, so I'll tACK as soon as the conflict is gone.
5196d96 to
cdcf080
Compare
|
Thanks!. Ive Rebased onto the latest master and:
|
tvpeter
left a comment
There was a problem hiding this comment.
Thank you @yan-pi for continuing to work on this.
Functionally, everything works as expected. The comments below focus on architectural separation: delegating persistence, config file edits, and error types to their designated modules. Once those are moved, you may find that some helper functions are redundant.
c02d5fd to
e6062c5
Compare
vadim-anfv
left a comment
There was a problem hiding this comment.
tACK e6062c5
Re-ran the September scenarios on this head, all as expected:
- unused configuration deleted,
config.tomlremoved with its last entry - wallet with persisted data refused, entry and data kept
- deleting one of two leaves the other working, rewritten
config.tomlstays mode 600 - unknown name and missing config both fail clearly
- redb: unused wallet deleted, shared store and the other wallet intact; a sqlite wallet beside the store is unaffected; an unreadable store names the wallet, the path and the cause
Left one non-blocking comment inline, about a test that no CI job compiles.
Run the cross-backend marker test with Redb enabled and SQLite disabled.
e6062c5 to
4445a26
Compare
vadim-anfv
left a comment
There was a problem hiding this comment.
ACK 4445a26
Only a rebase and the CI entry since my tACK on e6062c5, with git range-diff showing the original patches unchanged.
The new redb job now runs test_delete_rejects_foreign_sqlite_file_with_redb_marker, which nothing in the matrix compiled before.
caarloshenriq
left a comment
There was a problem hiding this comment.
tACK 4445a26
Saved three sqlite configs on regtest, deleted an unused one, got "not found" on repeat, and confirmed delete is refused after new_address persists data. Removing the last entry deletes config.toml. With redb, an unused wallet is deleted while another wallet's data lives in the shared wallet.redb, and the used one is refused
Description
Adds
wallets delete <wallet_name>to remove a saved wallet configuration.Saved configurations can be listed with
wallets list.Resolves #310.
Notes to the reviewers
List and delete use separate handlers and outputs.
Delete only removes the entry from
config.toml.Wallet database files arenot removed.
Changelog notice
wallets deleteto remove a saved wallet configurationChecklists
All Submissions:
cargo fmtandcargo clippybefore committingNew Features:
CHANGELOG.md