From 9b946ae527de1c525ef6241757a870ebde344ffb Mon Sep 17 00:00:00 2001 From: SyntheticBird45 Date: Thu, 29 Feb 2024 20:34:23 +0100 Subject: Removed default cryptonote address - Removed `localhost:8080` default value to address string in wallet rpc - Added an error response in case string is empty fixed indentation removed if and errors, default to localhost and port based on nettype Forgot ":" forgot ; and m_ removed wallet_rpc_server_error_codes.h --- src/wallet/wallet2.cpp | 5 +++++ src/wallet/wallet2.h | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 5a739d50d..81a0efe8d 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -1360,6 +1361,10 @@ bool wallet2::set_daemon(std::string daemon_address, boost::optional lock(m_daemon_rpc_mutex); + if(daemon_address.empty()) { + daemon_address.append("http://localhost:" + std::to_string(get_config(m_nettype).RPC_DEFAULT_PORT)); + } + if(m_http_client->is_connected()) m_http_client->disconnect(); CHECK_AND_ASSERT_MES2(m_proxy.empty() || proxy.empty() , "It is not possible to set global proxy (--proxy) and daemon specific proxy together."); diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 5f884e374..410676f90 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -991,13 +991,13 @@ private: uint64_t max_reorg_depth() const {return m_max_reorg_depth;} bool deinit(); - bool init(std::string daemon_address = "http://localhost:8080", + bool init(std::string daemon_address, boost::optional daemon_login = boost::none, const std::string &proxy = "", uint64_t upper_transaction_weight_limit = 0, bool trusted_daemon = true, epee::net_utils::ssl_options_t ssl_options = epee::net_utils::ssl_support_t::e_ssl_support_autodetect); - bool set_daemon(std::string daemon_address = "http://localhost:8080", + bool set_daemon(std::string daemon_address, boost::optional daemon_login = boost::none, bool trusted_daemon = true, epee::net_utils::ssl_options_t ssl_options = epee::net_utils::ssl_support_t::e_ssl_support_autodetect, const std::string &proxy = ""); -- cgit v1.2.3