aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-06-25 16:50:08 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-10-25 09:34:41 +0000
commitffa46026b5360decf5343b85fb267d026f41e760 (patch)
tree63a4c924fb9346c5b9859ac0236c778d3344e7b8 /src/wallet/wallet2.cpp
parentdaemon, wallet: new pay for RPC use system (diff)
downloadmonero-ffa46026b5360decf5343b85fb267d026f41e760.tar.xz
simplewallet: add public_nodes command
Lists nodes exposing their RPC port for public use
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r--src/wallet/wallet2.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index aecd01dec..5cebc7c23 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -13549,4 +13549,25 @@ uint64_t wallet2::get_bytes_received() const
{
return m_http_client.get_bytes_received();
}
+//----------------------------------------------------------------------------------------------------
+std::vector<cryptonote::public_node> wallet2::get_public_nodes(bool white_only)
+{
+ cryptonote::COMMAND_RPC_GET_PUBLIC_NODES::request req = AUTO_VAL_INIT(req);
+ cryptonote::COMMAND_RPC_GET_PUBLIC_NODES::response res = AUTO_VAL_INIT(res);
+
+ req.white = true;
+ req.gray = !white_only;
+
+ {
+ const boost::lock_guard<boost::recursive_mutex> lock{m_daemon_rpc_mutex};
+ bool r = epee::net_utils::invoke_http_json("/get_public_nodes", req, res, m_http_client, rpc_timeout);
+ THROW_ON_RPC_RESPONSE_ERROR_GENERIC(r, {}, res, "/get_public_nodes");
+ }
+
+ std::vector<cryptonote::public_node> nodes;
+ nodes = res.white;
+ nodes.reserve(nodes.size() + res.gray.size());
+ std::copy(res.gray.begin(), res.gray.end(), std::back_inserter(nodes));
+ return nodes;
+}
}