Merge pull request #6506

42e1484 wallet2: fix keys file deserialization exception handling (xiphon)
This commit is contained in:
luigi1111 2020-05-07 10:43:05 -05:00
commit 4c2f78aeeb
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010
1 changed files with 1 additions and 7 deletions

View File

@ -3990,13 +3990,7 @@ bool wallet2::load_keys(const std::string& keys_file_name, const epee::wipeable_
// Load keys from buffer // Load keys from buffer
boost::optional<crypto::chacha_key> keys_to_encrypt; boost::optional<crypto::chacha_key> keys_to_encrypt;
try {
r = wallet2::load_keys_buf(keys_file_buf, password, keys_to_encrypt); r = wallet2::load_keys_buf(keys_file_buf, password, keys_to_encrypt);
} catch (const std::exception& e) {
std::size_t found = string(e.what()).find("failed to deserialize keys buffer");
THROW_WALLET_EXCEPTION_IF(found != std::string::npos, error::wallet_internal_error, "internal error: failed to deserialize \"" + keys_file_name + '\"');
throw e;
}
// Rewrite with encrypted keys if unencrypted, ignore errors // Rewrite with encrypted keys if unencrypted, ignore errors
if (r && keys_to_encrypt != boost::none) if (r && keys_to_encrypt != boost::none)