1
0
Fork 0
forked from lthn/blockchain

fixed errors on get_seed_phrase_info

This commit is contained in:
cryptozoidberg 2020-12-01 19:28:41 +01:00
parent 60d6c44fb9
commit cc08086cac
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
2 changed files with 27 additions and 3 deletions

View file

@ -159,14 +159,30 @@ namespace currency
uint64_t auditable_flag_and_checksum = UINT64_MAX;
if (!auditable_flag_and_checksum_word.empty())
auditable_flag_and_checksum = tools::mnemonic_encoding::num_by_word(auditable_flag_and_checksum_word);
{
try {
auditable_flag_and_checksum = tools::mnemonic_encoding::num_by_word(auditable_flag_and_checksum_word);
}
catch (...)
{
return false;
}
}
std::vector<unsigned char> keys_seed_binary = tools::mnemonic_encoding::text2binary(keys_seed_text);
std::vector<unsigned char> keys_seed_processed_binary = keys_seed_binary;
bool has_password = false;
m_creation_timestamp = get_timstamp_from_word(timestamp_word, has_password);
try {
m_creation_timestamp = get_timstamp_from_word(timestamp_word, has_password);
}
catch (...)
{
return false;
}
//double check is password setting from timestamp word match with passed parameters
CHECK_AND_ASSERT_MES(has_password != seed_password.empty(), false, "Seed phrase password wrong interpretation");
if (has_password)

View file

@ -27,7 +27,15 @@ namespace tools
inline std::string get_seed_phrase_info(const std::string& seed_phrase, const std::string& seed_password, view::seed_phrase_info& result)
{
//cut the last timestamp word from restore_dats
result.syntax_correct = currency::account_base::is_seed_password_protected(seed_phrase, result.require_password);
try{
result.syntax_correct = currency::account_base::is_seed_password_protected(seed_phrase, result.require_password);
}
catch (...)
{
result.syntax_correct = false;
return API_RETURN_CODE_OK;
}
if (result.syntax_correct)
{
currency::account_base acc;