aboutsummaryrefslogtreecommitdiff
path: root/src/mnemonics/electrum-words.cpp
diff options
context:
space:
mode:
authorOran Juice <oranjuices@hotmail.com>2014-09-27 17:04:23 +0530
committerOran Juice <oranjuices@hotmail.com>2014-09-27 17:04:23 +0530
commit91aa25e055b918d9f9525f67d93c3f5a05f53024 (patch)
treecb981c17bb1241c3a27e45de9a72db6e50c76bbf /src/mnemonics/electrum-words.cpp
parentThrow error when word list file is empty and quick bug fix (diff)
downloadmonero-91aa25e055b918d9f9525f67d93c3f5a05f53024.tar.xz
Informs about old style mnemonics from older wallet and provides a new one. CMakeLists.txt update.
Diffstat (limited to '')
-rw-r--r--src/mnemonics/electrum-words.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mnemonics/electrum-words.cpp b/src/mnemonics/electrum-words.cpp
index 3ef7c5efc..897ab34e7 100644
--- a/src/mnemonics/electrum-words.cpp
+++ b/src/mnemonics/electrum-words.cpp
@@ -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