diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-04-02 12:17:35 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-04-02 12:17:35 +0100 |
commit | 548075b1f533cd68f4daad63e7688414718f6021 (patch) | |
tree | 6927b6a67fa5ad36d14805c3d1c015ef5f8a0b23 /src/daemon/rpc_command_executor.cpp | |
parent | Merge pull request #1930 (diff) | |
download | monero-548075b1f533cd68f4daad63e7688414718f6021.tar.xz |
daemon: new relay_tx command and RPC
Diffstat (limited to 'src/daemon/rpc_command_executor.cpp')
-rw-r--r-- | src/daemon/rpc_command_executor.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp index c5b17268d..249007436 100644 --- a/src/daemon/rpc_command_executor.cpp +++ b/src/daemon/rpc_command_executor.cpp @@ -1646,4 +1646,32 @@ bool t_rpc_command_executor::update(const std::string &command) return true; } +bool t_rpc_command_executor::relay_tx(const std::string &txid) +{ + cryptonote::COMMAND_RPC_RELAY_TX::request req; + cryptonote::COMMAND_RPC_RELAY_TX::response res; + std::string fail_message = "Unsuccessful"; + epee::json_rpc::error error_resp; + + req.txids.push_back(txid); + + if (m_is_rpc) + { + if (!m_rpc_client->json_rpc_request(req, res, "relay_tx", fail_message.c_str())) + { + return true; + } + } + else + { + if (!m_rpc_server->on_relay_tx(req, res, error_resp) || res.status != CORE_RPC_STATUS_OK) + { + tools::fail_msg_writer() << make_error(fail_message, res.status); + return true; + } + } + + return true; +} + }// namespace daemonize |