mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-13 22:53:27 +01:00
Merge pull request #2233
67ce4910
wallet2: store testnet bool in keys file (Jaquee)
This commit is contained in:
commit
d64b9c1c9e
@ -1959,6 +1959,9 @@ bool wallet2::store_keys(const std::string& keys_file_name, const std::string& p
|
|||||||
value2.SetInt(m_merge_destinations ? 1 :0);
|
value2.SetInt(m_merge_destinations ? 1 :0);
|
||||||
json.AddMember("merge_destinations", value2, json.GetAllocator());
|
json.AddMember("merge_destinations", value2, json.GetAllocator());
|
||||||
|
|
||||||
|
value2.SetInt(m_testnet ? 1 :0);
|
||||||
|
json.AddMember("testnet", value2, json.GetAllocator());
|
||||||
|
|
||||||
// Serialize the JSON object
|
// Serialize the JSON object
|
||||||
rapidjson::StringBuffer buffer;
|
rapidjson::StringBuffer buffer;
|
||||||
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
|
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
|
||||||
@ -2100,6 +2103,11 @@ bool wallet2::load_keys(const std::string& keys_file_name, const std::string& pa
|
|||||||
m_min_output_value = field_min_output_value;
|
m_min_output_value = field_min_output_value;
|
||||||
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, merge_destinations, int, Int, false, false);
|
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, merge_destinations, int, Int, false, false);
|
||||||
m_merge_destinations = field_merge_destinations;
|
m_merge_destinations = field_merge_destinations;
|
||||||
|
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, testnet, int, Int, false, m_testnet);
|
||||||
|
// Wallet is being opened with testnet flag, but is saved as a mainnet wallet
|
||||||
|
THROW_WALLET_EXCEPTION_IF(m_testnet && !field_testnet, error::wallet_internal_error, "Mainnet wallet can not be opened as testnet wallet");
|
||||||
|
// Wallet is being opened without testnet flag but is saved as a testnet wallet.
|
||||||
|
THROW_WALLET_EXCEPTION_IF(!m_testnet && field_testnet, error::wallet_internal_error, "Testnet wallet can not be opened as mainnet wallet");
|
||||||
}
|
}
|
||||||
|
|
||||||
const cryptonote::account_keys& keys = m_account.get_keys();
|
const cryptonote::account_keys& keys = m_account.get_keys();
|
||||||
|
Loading…
Reference in New Issue
Block a user