diff options
author | warptangent <warptangent@inbox.com> | 2014-12-06 03:09:46 -0800 |
---|---|---|
committer | warptangent <warptangent@inbox.com> | 2014-12-06 03:15:18 -0800 |
commit | f9822c483ead4c392fdf1f1317af31a1bfa9e228 (patch) | |
tree | 1bf25df63ec8c89c0ada3aee5506adc6cda406ae /src/wallet/wallet2.cpp | |
parent | Checking and handling for deterministic vs non-deterministic wallet (diff) | |
download | monero-f9822c483ead4c392fdf1f1317af31a1bfa9e228.tar.xz |
wallet JSON update for non-deterministic wallet data
wallet2::store_keys() and wallet2::load_keys() should only use the JSON
attribute "seed_language" when applicable. That is only for
deterministic wallets.
- store_keys() don't add JSON attribute "seed_language" if
seed_language is empty
- load_keys() don't call set_seed_language if JSON attribute
"seed_language" not present
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r-- | src/wallet/wallet2.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 58b715f20..163e19df4 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -486,8 +486,11 @@ bool wallet2::store_keys(const std::string& keys_file_name, const std::string& p rapidjson::Value value(rapidjson::kStringType); value.SetString(account_data.c_str(), account_data.length()); json.AddMember("key_data", value, json.GetAllocator()); - value.SetString(seed_language.c_str(), seed_language.length()); - json.AddMember("seed_language", value, json.GetAllocator()); + if (!seed_language.empty()) + { + value.SetString(seed_language.c_str(), seed_language.length()); + json.AddMember("seed_language", value, json.GetAllocator()); + } // Serialize the JSON object rapidjson::StringBuffer buffer; @@ -553,8 +556,11 @@ void wallet2::load_keys(const std::string& keys_file_name, const std::string& pa { account_data = std::string(json["key_data"].GetString(), json["key_data"].GetString() + json["key_data"].GetStringLength()); - set_seed_language(std::string(json["seed_language"].GetString(), json["seed_language"].GetString() + - json["seed_language"].GetStringLength())); + if (json.HasMember("seed_language")) + { + set_seed_language(std::string(json["seed_language"].GetString(), json["seed_language"].GetString() + + json["seed_language"].GetStringLength())); + } } const cryptonote::account_keys& keys = m_account.get_keys(); |