Use wallet workers

This commit is contained in:
Piotr Wójcik 2024-05-24 11:55:32 +02:00
commit 76e062e171
4 changed files with 11 additions and 1 deletions

View file

@ -70,6 +70,9 @@ std::string nano::thread_role::get_string (nano::thread_role::name role)
case nano::thread_role::name::bootstrap_worker:
thread_role_name_string = "Bootstrap work";
break;
case nano::thread_role::name::wallet_worker:
thread_role_name_string = "Wallet work";
break;
case nano::thread_role::name::request_aggregator:
thread_role_name_string = "Req aggregator";
break;

View file

@ -28,6 +28,7 @@ enum class name
confirmation_height_notifications,
worker,
bootstrap_worker,
wallet_worker,
request_aggregator,
state_block_signature_verification,
epoch_upgrader,

View file

@ -152,6 +152,7 @@ nano::node::node (std::shared_ptr<boost::asio::io_context> io_ctx_a, std::filesy
stats{ logger, config.stats_config },
workers{ config.background_threads, nano::thread_role::name::worker },
bootstrap_workers{ config.bootstrap_serving_threads, nano::thread_role::name::bootstrap_worker },
wallet_workers{ 1, nano::thread_role::name::wallet_worker },
flags (flags_a),
work (work_a),
distributed_work (*this),
@ -479,7 +480,7 @@ nano::node::node (std::shared_ptr<boost::asio::io_context> io_ctx_a, std::filesy
// TODO: Is it neccessary to call this for all blocks?
if (block->is_send ())
{
workers.push_task ([this, hash = block->hash (), destination = block->destination ()] () {
wallet_workers.push_task ([this, hash = block->hash (), destination = block->destination ()] () {
wallets.receive_confirmed (hash, destination);
});
}
@ -572,6 +573,8 @@ std::unique_ptr<nano::container_info_component> nano::collect_container_info (no
composite->add_component (collect_container_info (node.network, "network"));
composite->add_component (node.telemetry.collect_container_info ("telemetry"));
composite->add_component (collect_container_info (node.workers, "workers"));
composite->add_component (collect_container_info (node.bootstrap_workers, "bootstrap_workers"));
composite->add_component (collect_container_info (node.wallet_workers, "wallet_workers"));
composite->add_component (collect_container_info (node.observers, "observers"));
composite->add_component (collect_container_info (node.wallets, "wallets"));
composite->add_component (node.vote_processor.collect_container_info ("vote_processor"));
@ -728,6 +731,8 @@ void nano::node::stop ()
logger.info (nano::log::type::node, "Node stopping...");
bootstrap_workers.stop ();
wallet_workers.stop ();
vote_router.stop ();
peer_history.stop ();
// Cancels ongoing work generation tasks, which may be blocking other threads

View file

@ -155,6 +155,7 @@ public:
nano::stats stats;
nano::thread_pool workers;
nano::thread_pool bootstrap_workers;
nano::thread_pool wallet_workers;
nano::node_flags flags;
nano::work_pool & work;
nano::distributed_work_factory distributed_work;