diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2024-12-23 11:01:38 -0500 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2024-12-23 11:01:38 -0500 |
| commit | ee345b969511e068bde8b2c556105414aeee948b (patch) | |
| tree | 72fd526a54b5e76a4544c0e33769e4fe0d067b59 /src/wallet/wallet2.cpp | |
| parent | e2fcb9141fddc2e439a98456931b125dbaa1ebbf (diff) | |
| parent | cd1c06038c8d5eba28b2b9b1216b1c475538e770 (diff) | |
| download | monzero-core-ee345b969511e068bde8b2c556105414aeee948b.tar.gz monzero-core-ee345b969511e068bde8b2c556105414aeee948b.tar.xz monzero-core-ee345b969511e068bde8b2c556105414aeee948b.zip | |
Merge pull request #9590
cd1c060 Daemon-specific proxy for the wallet-rpc. 1. Daemon-specific proxy is exclusive with global proxy (--proxy). 2. If you set global proxy (--proxy) you cannot set daemon-specific proxy. 3. If you don't set global proxy, you can set proxy (or not set) proxy for each daemon connection with the proxy field in jsonrpc to the wallet-rpc. (0xFFFC0000)
Diffstat (limited to 'src/wallet/wallet2.cpp')
| -rw-r--r-- | src/wallet/wallet2.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 8651ebb7a..68f25de42 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -1280,6 +1280,11 @@ bool wallet2::has_stagenet_option(const boost::program_options::variables_map& v return command_line::get_arg(vm, options().stagenet); } +bool wallet2::has_proxy_option() const +{ + return !m_proxy.empty(); +} + std::string wallet2::device_name_option(const boost::program_options::variables_map& vm) { return command_line::get_arg(vm, options().hw_device); @@ -1364,12 +1369,15 @@ std::unique_ptr<wallet2> wallet2::make_dummy(const boost::program_options::varia } //---------------------------------------------------------------------------------------------------- -bool wallet2::set_daemon(std::string daemon_address, boost::optional<epee::net_utils::http::login> daemon_login, bool trusted_daemon, epee::net_utils::ssl_options_t ssl_options) +bool wallet2::set_daemon(std::string daemon_address, boost::optional<epee::net_utils::http::login> daemon_login, bool trusted_daemon, epee::net_utils::ssl_options_t ssl_options, const std::string& proxy) { boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex); 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."); + if(m_proxy.empty()) + CHECK_AND_ASSERT_MES(set_proxy(proxy), false, "failed to set proxy address"); const bool changed = m_daemon_address != daemon_address; m_daemon_address = std::move(daemon_address); m_daemon_login = std::move(daemon_login); @@ -1404,7 +1412,8 @@ bool wallet2::set_proxy(const std::string &address) //---------------------------------------------------------------------------------------------------- bool wallet2::init(std::string daemon_address, boost::optional<epee::net_utils::http::login> daemon_login, const std::string &proxy_address, uint64_t upper_transaction_weight_limit, bool trusted_daemon, epee::net_utils::ssl_options_t ssl_options) { - CHECK_AND_ASSERT_MES(set_proxy(proxy_address), false, "failed to set proxy address"); + m_proxy = proxy_address; + CHECK_AND_ASSERT_MES(set_proxy(m_proxy), false, "failed to set proxy address"); m_checkpoints.init_default_checkpoints(m_nettype); m_is_initialized = true; m_upper_transaction_weight_limit = upper_transaction_weight_limit; |
