From 5985c5afe8051ef9933212e62293ece3634a5024 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 2 Dec 2019 18:51:28 +0000 Subject: rpc: add bad-blocks to flush_cache RPC Flushes m_invalid_blocks in Blockchain. --- src/daemon/command_parser_executor.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/daemon/command_parser_executor.cpp') 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& 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; } -- cgit v1.2.3