diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-12-02 18:51:28 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-12-02 18:53:30 +0000 |
commit | 5985c5afe8051ef9933212e62293ece3634a5024 (patch) | |
tree | a3d54b1111c7f9d346c94900613943f2c84ca364 /src/daemon | |
parent | Merge pull request #6174 (diff) | |
download | monero-5985c5afe8051ef9933212e62293ece3634a5024.tar.xz |
rpc: add bad-blocks to flush_cache RPC
Flushes m_invalid_blocks in Blockchain.
Diffstat (limited to '')
-rw-r--r-- | src/daemon/command_parser_executor.cpp | 20 | ||||
-rw-r--r-- | src/daemon/command_server.cpp | 2 | ||||
-rw-r--r-- | src/daemon/rpc_command_executor.cpp | 3 | ||||
-rw-r--r-- | src/daemon/rpc_command_executor.h | 2 |
4 files changed, 21 insertions, 6 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp index b827221f6..8f06b1f01 100644 --- a/src/daemon/command_parser_executor.cpp +++ b/src/daemon/command_parser_executor.cpp @@ -846,13 +846,27 @@ bool t_command_parser_executor::set_bootstrap_daemon(const std::vector<std::stri bool t_command_parser_executor::flush_cache(const std::vector<std::string>& args) { + bool bad_txs = false, bad_blocks = false; + std::string arg; + if (args.empty()) goto show_list; - if (args[0] == "bad-txs") - return m_executor.flush_cache(true); + + for (size_t i = 0; i < args.size(); ++i) + { + arg = args[i]; + if (arg == "bad-txs") + bad_txs = true; + else if (arg == "bad-blocks") + bad_blocks = true; + else + goto show_list; + } + return m_executor.flush_cache(bad_txs, bad_blocks); show_list: - std::cout << "Cache type needed: bad-txs" << std::endl; + std::cout << "Invalid cache type: " << arg << std::endl; + std::cout << "Cache types: bad-txs bad-blocks" << std::endl; return true; } diff --git a/src/daemon/command_server.cpp b/src/daemon/command_server.cpp index 8ec690631..7fae77c30 100644 --- a/src/daemon/command_server.cpp +++ b/src/daemon/command_server.cpp @@ -325,7 +325,7 @@ t_command_server::t_command_server( m_command_lookup.set_handler( "flush_cache" , std::bind(&t_command_parser_executor::flush_cache, &m_parser, p::_1) - , "flush_cache bad-txs" + , "flush_cache [bad-txs] [bad-blocks]" , "Flush the specified cache(s)." ); } diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp index ed614a89b..0fae9b99e 100644 --- a/src/daemon/rpc_command_executor.cpp +++ b/src/daemon/rpc_command_executor.cpp @@ -2373,7 +2373,7 @@ bool t_rpc_command_executor::set_bootstrap_daemon( return true; } -bool t_rpc_command_executor::flush_cache(bool bad_txs) +bool t_rpc_command_executor::flush_cache(bool bad_txs, bool bad_blocks) { cryptonote::COMMAND_RPC_FLUSH_CACHE::request req; cryptonote::COMMAND_RPC_FLUSH_CACHE::response res; @@ -2381,6 +2381,7 @@ bool t_rpc_command_executor::flush_cache(bool bad_txs) epee::json_rpc::error error_resp; req.bad_txs = bad_txs; + req.bad_blocks = bad_blocks; if (m_is_rpc) { diff --git a/src/daemon/rpc_command_executor.h b/src/daemon/rpc_command_executor.h index e8b12cb9b..6276d124d 100644 --- a/src/daemon/rpc_command_executor.h +++ b/src/daemon/rpc_command_executor.h @@ -170,7 +170,7 @@ public: bool rpc_payments(); - bool flush_cache(bool bad_txs); + bool flush_cache(bool bad_txs, bool invalid_blocks); }; } // namespace daemonize |