mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
Informs about old style mnemonics from older wallet and provides a new one. CMakeLists.txt update.
This commit is contained in:
parent
262e155bab
commit
91aa25e055
@ -43,10 +43,7 @@ file(GLOB_RECURSE WALLET wallet/*)
|
||||
file(GLOB_RECURSE MINER miner/*)
|
||||
file(GLOB MNEMONICS mnemonics/*)
|
||||
|
||||
file(GLOB NEW_WORD_LISTS mnemonics/wordlists/languages/*)
|
||||
file(GLOB OLD_WORD_LIST mnemonics/wordlists/*)
|
||||
file(COPY ${NEW_WORD_LISTS} DESTINATION "${CMAKE_SOURCE_DIR}/build/release/src/wordlists/languages")
|
||||
file(COPY ${OLD_WORD_LIST} DESTINATION "${CMAKE_SOURCE_DIR}/build/release/src/wordlists")
|
||||
file(COPY "mnemonics/wordlists/" DESTINATION "${CMAKE_SOURCE_DIR}/build/release/src/wordlists")
|
||||
|
||||
source_group(common FILES ${COMMON})
|
||||
source_group(crypto FILES ${CRYPTO})
|
||||
|
@ -50,6 +50,8 @@ namespace
|
||||
std::map<std::string,uint32_t> words_map;
|
||||
std::vector<std::string> words_array;
|
||||
|
||||
bool is_old_style_mnemonics = false;
|
||||
|
||||
const std::string WORD_LISTS_DIRECTORY = "wordlists";
|
||||
const std::string LANGUAGES_DIRECTORY = "languages";
|
||||
const std::string OLD_WORD_FILE = "old-word-list";
|
||||
@ -103,10 +105,12 @@ namespace crypto
|
||||
if (old_word_list)
|
||||
{
|
||||
create_data_structures(WORD_LISTS_DIRECTORY + '/' + OLD_WORD_FILE);
|
||||
is_old_style_mnemonics = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
create_data_structures(WORD_LISTS_DIRECTORY + '/' + LANGUAGES_DIRECTORY + '/' + language);
|
||||
is_old_style_mnemonics = false;
|
||||
}
|
||||
if (num_words == 0)
|
||||
{
|
||||
@ -115,6 +119,14 @@ namespace crypto
|
||||
}
|
||||
}
|
||||
|
||||
bool get_is_old_style_mnemonics()
|
||||
{
|
||||
if (is_uninitialized())
|
||||
{
|
||||
throw std::runtime_error("ElectrumWords hasn't been initialized with a word list yet.");
|
||||
}
|
||||
return is_old_style_mnemonics;
|
||||
}
|
||||
/* convert words to bytes, 3 words -> 4 bytes
|
||||
* returns:
|
||||
* false if not a multiple of 3 words, or if a words is not in the
|
||||
|
@ -45,5 +45,6 @@ namespace crypto
|
||||
bool words_to_bytes(const std::string& words, crypto::secret_key& dst);
|
||||
bool bytes_to_words(const crypto::secret_key& src, std::string& words);
|
||||
void get_language_list(std::vector<std::string> &languages);
|
||||
bool get_is_old_style_mnemonics();
|
||||
}
|
||||
}
|
||||
|
2048
src/mnemonics/wordlists/languages/english
Normal file
2048
src/mnemonics/wordlists/languages/english
Normal file
File diff suppressed because it is too large
Load Diff
2048
src/mnemonics/wordlists/languages/japanese
Normal file
2048
src/mnemonics/wordlists/languages/japanese
Normal file
File diff suppressed because it is too large
Load Diff
1626
src/mnemonics/wordlists/languages/portuguese
Normal file
1626
src/mnemonics/wordlists/languages/portuguese
Normal file
File diff suppressed because it is too large
Load Diff
2048
src/mnemonics/wordlists/languages/spanish
Normal file
2048
src/mnemonics/wordlists/languages/spanish
Normal file
File diff suppressed because it is too large
Load Diff
@ -498,9 +498,15 @@ bool simple_wallet::new_wallet(const string &wallet_file, const std::string& pas
|
||||
// convert rng value to electrum-style word list
|
||||
std::string electrum_words;
|
||||
|
||||
if (!m_restore_deterministic_wallet)
|
||||
if (!m_restore_deterministic_wallet || crypto::ElectrumWords::get_is_old_style_mnemonics())
|
||||
{
|
||||
// Ask for language only if it not a wallet restore.
|
||||
if (crypto::ElectrumWords::get_is_old_style_mnemonics())
|
||||
{
|
||||
message_writer(epee::log_space::console_color_green, false) << "\nYou have been using " <<
|
||||
"a deprecated word list file. Please use the new seed that we provide.\n";
|
||||
}
|
||||
// Ask for language if it is not a wallet restore or if the old version of the wallet
|
||||
// had given the user an old style word list.
|
||||
std::string mnemonic_language = get_mnemonic_language();
|
||||
try
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user