diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2019-09-08 19:46:03 -0500 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2019-09-08 19:46:03 -0500 |
| commit | 21290005d75501d692d06dfdd26676392949ba8a (patch) | |
| tree | a089e2c1706409fb760be0a3beda595a623fb89e /src/daemon/rpc_command_executor.cpp | |
| parent | 15dabf7d18244ec5e592f2ad4cfe49495c4d1c80 (diff) | |
| parent | 063eebbd434d25fc7880edfd31d33d602b9ff306 (diff) | |
| download | monzero-core-21290005d75501d692d06dfdd26676392949ba8a.tar.gz monzero-core-21290005d75501d692d06dfdd26676392949ba8a.tar.xz monzero-core-21290005d75501d692d06dfdd26676392949ba8a.zip | |
Merge pull request #5840
063eebb daemon: implement 'set_bootstrap_daemon' command (xiphon)
Diffstat (limited to 'src/daemon/rpc_command_executor.cpp')
| -rw-r--r-- | src/daemon/rpc_command_executor.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp index 670affd76..716dea204 100644 --- a/src/daemon/rpc_command_executor.cpp +++ b/src/daemon/rpc_command_executor.cpp @@ -2320,4 +2320,40 @@ bool t_rpc_command_executor::check_blockchain_pruning() return true; } +bool t_rpc_command_executor::set_bootstrap_daemon( + const std::string &address, + const std::string &username, + const std::string &password) +{ + cryptonote::COMMAND_RPC_SET_BOOTSTRAP_DAEMON::request req; + cryptonote::COMMAND_RPC_SET_BOOTSTRAP_DAEMON::response res; + const std::string fail_message = "Unsuccessful"; + + req.address = address; + req.username = username; + req.password = password; + + if (m_is_rpc) + { + if (!m_rpc_client->rpc_request(req, res, "/set_bootstrap_daemon", fail_message)) + { + return true; + } + } + else + { + if (!m_rpc_server->on_set_bootstrap_daemon(req, res) || res.status != CORE_RPC_STATUS_OK) + { + tools::fail_msg_writer() << make_error(fail_message, res.status); + return true; + } + } + + tools::success_msg_writer() + << "Successfully set bootstrap daemon address to " + << (!req.address.empty() ? req.address : "none"); + + return true; +} + }// namespace daemonize |
