change m_http_client from shared_ptr to unique_ptr

This commit is contained in:
woodser
2020-02-23 20:59:11 -05:00
parent b5cbd1dae4
commit 500667049e
2 changed files with 12 additions and 12 deletions
+8 -8
View File
@@ -809,12 +809,12 @@ namespace monero {
return wallet;
}
monero_wallet_core* monero_wallet_core::open_wallet(const string& password, const monero_network_type network_type, const string& keys_data, const string& cache_data, const monero_rpc_connection& daemon_connection, shared_ptr<epee::net_utils::http::abstract_http_client> http_client) {
monero_wallet_core* monero_wallet_core::open_wallet(const string& password, const monero_network_type network_type, const string& keys_data, const string& cache_data, const monero_rpc_connection& daemon_connection, unique_ptr<epee::net_utils::http::abstract_http_client> http_client) {
MTRACE("open_wallet(...buffers...)");
cout << "open_wallet(...buffers...)" << endl;
monero_wallet_core* wallet = new monero_wallet_core();
if (http_client == nullptr) wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true));
else wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true, http_client));
else wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true, std::move(http_client)));
wallet->m_w2->load("", password, keys_data, cache_data);
wallet->m_w2->init("");
wallet->set_daemon_connection(daemon_connection);
@@ -822,11 +822,11 @@ namespace monero {
return wallet;
}
monero_wallet_core* monero_wallet_core::create_wallet_random(const string& path, const string& password, const monero_network_type network_type, const monero_rpc_connection& daemon_connection, const string& language, shared_ptr<epee::net_utils::http::abstract_http_client> http_client) {
monero_wallet_core* monero_wallet_core::create_wallet_random(const string& path, const string& password, const monero_network_type network_type, const monero_rpc_connection& daemon_connection, const string& language, unique_ptr<epee::net_utils::http::abstract_http_client> http_client) {
MTRACE("create_wallet_random(path, password, network_type, daemon_connection, language)");
monero_wallet_core* wallet = new monero_wallet_core();
if (http_client == nullptr) wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true));
else wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true, http_client));
else wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true, std::move(http_client)));
wallet->set_daemon_connection(daemon_connection);
wallet->m_w2->set_seed_language(language);
crypto::secret_key secret_key;
@@ -836,7 +836,7 @@ namespace monero {
return wallet;
}
monero_wallet_core* monero_wallet_core::create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type network_type, const string& mnemonic, const monero_rpc_connection& daemon_connection, uint64_t restore_height, const string& seed_offset, shared_ptr<epee::net_utils::http::abstract_http_client> http_client) {
monero_wallet_core* monero_wallet_core::create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type network_type, const string& mnemonic, const monero_rpc_connection& daemon_connection, uint64_t restore_height, const string& seed_offset, unique_ptr<epee::net_utils::http::abstract_http_client> http_client) {
MTRACE("create_wallet_from_mnemonic(path, password, mnemonic, network_type, daemon_connection, restore_height)");
monero_wallet_core* wallet = new monero_wallet_core();
@@ -852,7 +852,7 @@ namespace monero {
// initialize wallet
if (http_client == nullptr) wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true));
else wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true, http_client));
else wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true, std::move(http_client)));
wallet->set_daemon_connection(daemon_connection);
wallet->m_w2->set_seed_language(language);
wallet->m_w2->generate(path, password, recovery_key, true, false);
@@ -861,7 +861,7 @@ namespace monero {
return wallet;
}
monero_wallet_core* monero_wallet_core::create_wallet_from_keys(const string& path, const string& password, const monero_network_type network_type, const string& address, const string& view_key, const string& spend_key, const monero_rpc_connection& daemon_connection, uint64_t restore_height, const string& language, shared_ptr<epee::net_utils::http::abstract_http_client> http_client) {
monero_wallet_core* monero_wallet_core::create_wallet_from_keys(const string& path, const string& password, const monero_network_type network_type, const string& address, const string& view_key, const string& spend_key, const monero_rpc_connection& daemon_connection, uint64_t restore_height, const string& language, unique_ptr<epee::net_utils::http::abstract_http_client> http_client) {
MTRACE("create_wallet_from_keys(path, password, address, view_key, spend_key, network_type, daemon_connection, restore_height, language)");
monero_wallet_core* wallet = new monero_wallet_core();
@@ -909,7 +909,7 @@ namespace monero {
// initialize wallet
if (http_client == nullptr) wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true));
else wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true, http_client));
else wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true, std::move(http_client)));
if (has_spend_key && has_view_key) wallet->m_w2->generate(path, password, info.address, spend_key_sk, view_key_sk);
else if (has_spend_key) wallet->m_w2->generate(path, password, spend_key_sk, true, false);
else wallet->m_w2->generate(path, password, info.address, view_key_sk);
+4 -4
View File
@@ -111,7 +111,7 @@ namespace monero {
* @param http_client allows the http client to be overriden (defaults to monero-project's http_client.h)
* @return a pointer to the wallet instance
*/
static monero_wallet_core* open_wallet(const string& password, const monero_network_type, const string& keys_data, const string& cache_data, const monero_rpc_connection& daemon_connection = monero_rpc_connection(), shared_ptr<epee::net_utils::http::abstract_http_client> http_client = nullptr);
static monero_wallet_core* open_wallet(const string& password, const monero_network_type, const string& keys_data, const string& cache_data, const monero_rpc_connection& daemon_connection = monero_rpc_connection(), unique_ptr<epee::net_utils::http::abstract_http_client> http_client = nullptr);
/**
* Create a new wallet with a randomly generated seed.
@@ -124,7 +124,7 @@ namespace monero {
* @param http_client allows the http client to be overriden (defaults to monero-project's http_client.h)
* @return a pointer to the wallet instance
*/
static monero_wallet_core* create_wallet_random(const string& path, const string& password, const monero_network_type network_type, const monero_rpc_connection& daemon_connection = monero_rpc_connection(), const string& language = "English", shared_ptr<epee::net_utils::http::abstract_http_client> http_client = nullptr);
static monero_wallet_core* create_wallet_random(const string& path, const string& password, const monero_network_type network_type, const monero_rpc_connection& daemon_connection = monero_rpc_connection(), const string& language = "English", unique_ptr<epee::net_utils::http::abstract_http_client> http_client = nullptr);
/**
* Create a wallet from an existing mnemonic phrase.
@@ -138,7 +138,7 @@ namespace monero {
* @param http_client allows the http client to be overriden (defaults to monero-project's http_client.h)
* @return a pointer to the wallet instance
*/
static monero_wallet_core* create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type network_type, const string& mnemonic, const monero_rpc_connection& daemon_connection = monero_rpc_connection(), uint64_t restore_height = 0, const string& seed_offset = "", shared_ptr<epee::net_utils::http::abstract_http_client> http_client = nullptr);
static monero_wallet_core* create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type network_type, const string& mnemonic, const monero_rpc_connection& daemon_connection = monero_rpc_connection(), uint64_t restore_height = 0, const string& seed_offset = "", unique_ptr<epee::net_utils::http::abstract_http_client> http_client = nullptr);
/**
* Create a wallet from an address, view key, and spend key.
@@ -154,7 +154,7 @@ namespace monero {
* @param language is the wallet and mnemonic's language (defaults to "English")
* @return a pointer to the wallet instance
*/
static monero_wallet_core* create_wallet_from_keys(const string& path, const string& password, const monero_network_type network_type, const string& address, const string& view_key, const string& spend_key, const monero_rpc_connection& daemon_connection = monero_rpc_connection(), uint64_t restore_height = 0, const string& language = "English", shared_ptr<epee::net_utils::http::abstract_http_client> http_client = nullptr);
static monero_wallet_core* create_wallet_from_keys(const string& path, const string& password, const monero_network_type network_type, const string& address, const string& view_key, const string& spend_key, const monero_rpc_connection& daemon_connection = monero_rpc_connection(), uint64_t restore_height = 0, const string& language = "English", unique_ptr<epee::net_utils::http::abstract_http_client> http_client = nullptr);
/**
* Get a list of available languages for the wallet's mnemonic phrase.