blockchain sync: reduce disk writes from 2 to 1 per tx

This commit is contained in:
jeffro256
2024-01-17 17:17:16 -06:00
parent d0118f4778
commit 008ba966da
29 changed files with 1186 additions and 1636 deletions

View File

@@ -1063,7 +1063,7 @@ 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;
bool bad_blocks = false;
std::string arg;
if (args.empty())
@@ -1072,18 +1072,16 @@ bool t_command_parser_executor::flush_cache(const std::vector<std::string>& args
for (size_t i = 0; i < args.size(); ++i)
{
arg = args[i];
if (arg == "bad-txs")
bad_txs = true;
else if (arg == "bad-blocks")
if (arg == "bad-blocks")
bad_blocks = true;
else
goto show_list;
}
return m_executor.flush_cache(bad_txs, bad_blocks);
return m_executor.flush_cache(bad_blocks);
show_list:
std::cout << "Invalid cache type: " << arg << std::endl;
std::cout << "Cache types: bad-txs bad-blocks" << std::endl;
std::cout << "Cache types: bad-blocks" << std::endl;
return true;
}