rpc: add a flush_cache RPC

This allows flushing internal caches (for now, the bad tx cache,
which will allow debugging a stuck monerod after it has failed to
verify a transaction in a block, since it would otherwise not try
again, making subsequent log changes pointless)
This commit is contained in:
moneromooo-monero
2019-10-22 15:28:08 +00:00
parent 960c215801
commit a4dc575ccb
11 changed files with 103 additions and 7 deletions

View File

@@ -844,4 +844,16 @@ bool t_command_parser_executor::set_bootstrap_daemon(const std::vector<std::stri
args_count > 2 ? args[2] : std::string());
}
bool t_command_parser_executor::flush_cache(const std::vector<std::string>& args)
{
if (args.empty())
goto show_list;
if (args[0] == "bad-txs")
return m_executor.flush_cache(true);
show_list:
std::cout << "Cache type needed: bad-txs" << std::endl;
return true;
}
} // namespace daemonize