-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix keystore creation bug #267
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ impl Runnable for ImportEthKeyCmd { | |
fn run(&self) { | ||
let config = APP.config(); | ||
let keystore = path::Path::new(&config.keystore); | ||
let keystore = FsKeyStore::create_or_open(keystore).expect("Could not open keystore"); | ||
let keystore = FsKeyStore::open(keystore).expect("Could not open keystore"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Verify the existence of the keystore before opening it. The change to use if !keystore.exists() {
eprintln!("Keystore does not exist, exiting.");
return;
}
let keystore = FsKeyStore::open(keystore).expect("Could not open keystore"); |
||
|
||
let name = self.name.parse().expect("Could not parse name"); | ||
if let Ok(_info) = keystore.info(&name) { | ||
|
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.
Verify the existence of the keystore before opening it.
The change to use
FsKeyStore::open(keystore)
ensures that only existing keystores are accessed. However, this might lead to an error if the keystore does not exist. Consider adding a check to verify the existence of the keystore before attempting to open it.