Skip to content

Try to unlock account only when it is imported #1798

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

Merged
merged 3 commits into from
Sep 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions codechain/run_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,13 @@ fn load_password_file(path: &Option<String>) -> Result<PasswordFile, String> {
fn unlock_accounts(ap: &AccountProvider, pf: &PasswordFile) -> Result<(), String> {
for entry in pf.entries() {
let entry_address = entry.address.into_address();
ap.unlock_account_permanently(entry_address, entry.password.clone())
.map_err(|e| format!("Failed to unlock account {}: {}", entry_address, e))?;
let has_account = ap
.has_account(&entry_address)
.map_err(|e| format!("Unexpected error while querying account {}: {}", entry_address, e))?;
if has_account {
ap.unlock_account_permanently(entry_address, entry.password.clone())
.map_err(|e| format!("Failed to unlock account {}: {}", entry_address, e))?;
}
}
Ok(())
}
Expand Down