mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-11-18 14:14:04 +01:00
remove years from copyrights
validate language on wallet creation and standardize error message
This commit is contained in:
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user