From 08e2f0fbf10d5dc1830332eb3746bfd4e22da605 Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Thu, 8 Aug 2024 15:55:50 +0400 Subject: [PATCH] fixed space-failing of the seed phrase --- src/currency_core/account.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/currency_core/account.cpp b/src/currency_core/account.cpp index def20255..675d2f1e 100644 --- a/src/currency_core/account.cpp +++ b/src/currency_core/account.cpp @@ -127,11 +127,12 @@ namespace currency return true; } //----------------------------------------------------------------- - bool account_base::restore_from_seed_phrase(const std::string& seed_phrase, const std::string& seed_password) + bool account_base::restore_from_seed_phrase(const std::string& seed_phrase_, const std::string& seed_password) { //cut the last timestamp word from restore_dats std::list words; - boost::split(words, seed_phrase, boost::is_space()); + std::string seed_phrase = epee::string_tools::trim(seed_phrase_); + boost::split(words, seed_phrase, boost::is_space(), boost::token_compress_on); std::string keys_seed_text, timestamp_word, auditable_flag_and_checksum_word; if (words.size() == SEED_PHRASE_V1_WORDS_COUNT) @@ -230,11 +231,13 @@ namespace currency return seed_phrase.find(':') != std::string::npos; } //----------------------------------------------------------------- - bool account_base::is_seed_password_protected(const std::string& seed_phrase, bool& is_password_protected) + bool account_base::is_seed_password_protected(const std::string& seed_phrase_, bool& is_password_protected) { //cut the last timestamp word from restore_dats std::list words; - boost::split(words, seed_phrase, boost::is_space()); + + std::string seed_phrase = epee::string_tools::trim(seed_phrase_); + boost::split(words, seed_phrase, boost::is_space(), boost::token_compress_on); //let's validate each word for (const auto& w: words)