From 008ba966da88f073f226b299533faca905ceabf8 Mon Sep 17 00:00:00 2001 From: jeffro256 Date: Wed, 17 Jan 2024 17:17:16 -0600 Subject: blockchain sync: reduce disk writes from 2 to 1 per tx --- src/daemon/command_parser_executor.cpp | 10 ++++------ src/daemon/daemon.cpp | 2 +- src/daemon/rpc_command_executor.cpp | 3 +-- src/daemon/rpc_command_executor.h | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) (limited to 'src/daemon') diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp index 087a4e48b..0c091c7ed 100644 --- a/src/daemon/command_parser_executor.cpp +++ b/src/daemon/command_parser_executor.cpp @@ -1063,7 +1063,7 @@ bool t_command_parser_executor::set_bootstrap_daemon(const std::vector& 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& 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; } diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp index 286c02b50..2512e5430 100644 --- a/src/daemon/daemon.cpp +++ b/src/daemon/daemon.cpp @@ -119,9 +119,9 @@ public: if (shared) { + core.get().get_blockchain_storage().set_txpool_notify(cryptonote::listener::zmq_pub::txpool_add{shared}); core.get().get_blockchain_storage().add_block_notify(cryptonote::listener::zmq_pub::chain_main{shared}); core.get().get_blockchain_storage().add_miner_notify(cryptonote::listener::zmq_pub::miner_data{shared}); - core.get().set_txpool_listener(cryptonote::listener::zmq_pub::txpool_add{shared}); } } } diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp index b6364ff77..12842691d 100644 --- a/src/daemon/rpc_command_executor.cpp +++ b/src/daemon/rpc_command_executor.cpp @@ -2440,14 +2440,13 @@ bool t_rpc_command_executor::set_bootstrap_daemon( return true; } -bool t_rpc_command_executor::flush_cache(bool bad_txs, bool bad_blocks) +bool t_rpc_command_executor::flush_cache(bool bad_blocks) { 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; 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 ebd7eda85..0f98029ab 100644 --- a/src/daemon/rpc_command_executor.h +++ b/src/daemon/rpc_command_executor.h @@ -172,7 +172,7 @@ public: bool rpc_payments(); - bool flush_cache(bool bad_txs, bool invalid_blocks); + bool flush_cache(bool invalid_blocks); }; } // namespace daemonize -- cgit v1.2.3