mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
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
This commit is contained in:
parent
4c6230d6cf
commit
f9822c483e
1 changed files with 10 additions and 4 deletions
|
@ -486,8 +486,11 @@ bool wallet2::store_keys(const std::string& keys_file_name, const std::string& p
|
||||||
rapidjson::Value value(rapidjson::kStringType);
|
rapidjson::Value value(rapidjson::kStringType);
|
||||||
value.SetString(account_data.c_str(), account_data.length());
|
value.SetString(account_data.c_str(), account_data.length());
|
||||||
json.AddMember("key_data", value, json.GetAllocator());
|
json.AddMember("key_data", value, json.GetAllocator());
|
||||||
|
if (!seed_language.empty())
|
||||||
|
{
|
||||||
value.SetString(seed_language.c_str(), seed_language.length());
|
value.SetString(seed_language.c_str(), seed_language.length());
|
||||||
json.AddMember("seed_language", value, json.GetAllocator());
|
json.AddMember("seed_language", value, json.GetAllocator());
|
||||||
|
}
|
||||||
|
|
||||||
// Serialize the JSON object
|
// Serialize the JSON object
|
||||||
rapidjson::StringBuffer buffer;
|
rapidjson::StringBuffer buffer;
|
||||||
|
@ -553,9 +556,12 @@ 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() +
|
account_data = std::string(json["key_data"].GetString(), json["key_data"].GetString() +
|
||||||
json["key_data"].GetStringLength());
|
json["key_data"].GetStringLength());
|
||||||
|
if (json.HasMember("seed_language"))
|
||||||
|
{
|
||||||
set_seed_language(std::string(json["seed_language"].GetString(), json["seed_language"].GetString() +
|
set_seed_language(std::string(json["seed_language"].GetString(), json["seed_language"].GetString() +
|
||||||
json["seed_language"].GetStringLength()));
|
json["seed_language"].GetStringLength()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const cryptonote::account_keys& keys = m_account.get_keys();
|
const cryptonote::account_keys& keys = m_account.get_keys();
|
||||||
r = epee::serialization::load_t_from_binary(m_account, account_data);
|
r = epee::serialization::load_t_from_binary(m_account, account_data);
|
||||||
|
|
Loading…
Reference in a new issue