-
Notifications
You must be signed in to change notification settings - Fork 98
Check for any existing wallet file in case wallet_file_name is given None.
#305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #305 +/- ##
==========================================
+ Coverage 73.51% 73.56% +0.05%
==========================================
Files 33 33
Lines 4104 4082 -22
==========================================
- Hits 3017 3003 -14
+ Misses 1087 1079 -8 ☔ View full report in Codecov by Sentry. |
6715720 to
ec0d12e
Compare
mojoX911
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept Ack.
But it needs some more thinking and redesign. Our random naming behavior is not at all UX friendly, and better if we drop it or keep it test only.
Deatils below.
ec0d12e to
ec732cd
Compare
Shourya742
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK. Just minor nits. We'll remove the static dispatch stuff once we've finalized our APIs. Until then, there's no harm in keeping them, though they might slightly increase the binary size, but not by a significant margin.
mojoX911
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack. Great cleanup. Just one nit. No other blocking comments from my side.
This now nicely goes into following fixes for UX that can be done in followup PRs.
-
Show the mnemonic, only once at init, so the user can back it up. This will require bringing back
bip39. -
Allow for wallet discovery using a mnemonic. User puts in the mnemonic and the wallet find all the seed and fidelity utxos. Swapcoins would be lost tho, for that we need to find some ways to backup the swap data.
-
Add password protection on the wallet. Its embarrassing to have wallet data in clear. We have postponed it so far but now is the time to patch it. If we can use some encrypt decrypt API from secp or rust-bitcoin lib that would be best.
Including the first task here itself , as it's small change. |
c8af5c2 to
3096859
Compare
|
It's ready. |
There is no benefit in considering `taker_behaviour` as Optional This often ends up in passing `None` in `TestFramework::init` at many places , which makes it a bit confusing. Thus making it a mandatory field helps to be more explicit here.
This also includes: - replace the concept of using fingerprint of `master_key` as wallet name to `maker/taker-wallet`. - Showinng `mnemoics` while deriving `Master key` of new wallet. - Use `&Path` instead of `&PathBuf` to make these the api's flexible.
mojoX911
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack
Check for any existing wallet file in case `wallet_file_name` is given `None`.
Changing the
wallet_nameargument to be of typeOption<String>in PR 291 introduces an internal bug.Bug:
Now ,
taker/makerdcli creates a new wallet each time we call there command if we do not pass thewallet_nameargument.Why:
coinswap/src/taker/api.rs
Lines 186 to 205 in 972585c
As per our current implemetation, we first check the value of
wallet_file_path-> if it isNone-> then it creates a new wallet.Why we don't get this error before this change?
Before that ,
args.wallet_nameis set to the default value i.etakerin case oftaker-clibefore passing it toTaker::initapi -> that's why it often loads up the same wallet even though we do not pass the wallet argument.This Pr aims to fix this bug by searching for any existing wallet file in the
wallets_dirin casewallet_file_pathis passed asNone.It also simplifies the wallet related logic in both
Taker::initandMaker::init.Solution (After discussion):
maker/taker-walletifwallet_file_name=Noneinstead ofmaker-unique_identifierwhere this identifier is created from mnemonics.Note to Reviewers:
In 2e4f8e4
I try to make
file_pathinput more flexible by consideringimpl<AsRef<Path>>instead of&PathBufor&Pathetcas mentioned in Rust Design pattern
This pattern is often used in low level crates as it provides flexibility at the caller site that it can take any value of type which must implements
AsRef<Path>.IMO, It would be useful when we will modularise our crate but for now, It seems a bit over-engineered to me.
what's your say?