diff options
author | luigi1111 <luigi1111w@gmail.com> | 2019-10-25 14:20:20 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2019-10-25 14:20:20 -0500 |
commit | f253bf384674ae8a2f1d0652cb27ff17c7fc1fc1 (patch) | |
tree | 81bc979a941aecb93600e900ddf6a7bb5a81fc4b /src/daemon/rpc_command_executor.cpp | |
parent | Merge pull request #6023 (diff) | |
parent | rpc: add a flush_cache RPC (diff) | |
download | monero-f253bf384674ae8a2f1d0652cb27ff17c7fc1fc1.tar.xz |
Merge pull request #6007
a4dc575 rpc: add a flush_cache RPC (moneromooo-monero)
Diffstat (limited to '')
-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 552862d2f..ed614a89b 100644 --- a/src/daemon/rpc_command_executor.cpp +++ b/src/daemon/rpc_command_executor.cpp @@ -2373,6 +2373,34 @@ bool t_rpc_command_executor::set_bootstrap_daemon( return true; } +bool t_rpc_command_executor::flush_cache(bool bad_txs) +{ + cryptonote::COMMAND_RPC_FLUSH_CACHE::request req; + cryptonote::COMMAND_RPC_FLUSH_CACHE::response res; + std::string fail_message = "Unsuccessful"; + epee::json_rpc::error error_resp; + + req.bad_txs = bad_txs; + + if (m_is_rpc) + { + if (!m_rpc_client->json_rpc_request(req, res, "flush_cache", fail_message.c_str())) + { + return true; + } + } + else + { + if (!m_rpc_server->on_flush_cache(req, res, error_resp) || res.status != CORE_RPC_STATUS_OK) + { + tools::fail_msg_writer() << make_error(fail_message, res.status); + return true; + } + } + + return true; +} + bool t_rpc_command_executor::rpc_payments() { cryptonote::COMMAND_RPC_ACCESS_DATA::request req; |