remove years from copyrights

validate language on wallet creation and standardize error message
This commit is contained in:
woodser
2020-06-18 13:42:14 -04:00
parent 8f91f48a10
commit 557a81d875
15 changed files with 48 additions and 19 deletions
+5 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017-2019 woodser
* Copyright (c) woodser
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -853,6 +853,7 @@ namespace monero {
monero_wallet_core* monero_wallet_core::create_wallet_random(const std::string& path, const std::string& password, const monero_network_type network_type, const monero_rpc_connection& daemon_connection, const std::string& language, std::unique_ptr<epee::net_utils::http::http_client_factory> http_client_factory) {
MTRACE("create_wallet_random(...)");
if (!monero_utils::is_valid_language(language)) throw std::runtime_error("Unknown language: " + language);
monero_wallet_core* wallet = new monero_wallet_core();
if (http_client_factory == nullptr) wallet->m_w2 = std::unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true));
else wallet->m_w2 = std::unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true, std::move(http_client_factory)));
@@ -936,6 +937,9 @@ namespace monero {
if (info.address.m_view_public_key != pkey) throw std::runtime_error("view key does not match address");
}
// validate language
if (!monero_utils::is_valid_language(language)) throw std::runtime_error("Unknown language: " + language);
// initialize wallet
if (http_client_factory == nullptr) wallet->m_w2 = std::unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true));
else wallet->m_w2 = std::unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true, std::move(http_client_factory)));