Skip to content

Commit

Permalink
Use wallet workers
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed May 24, 2024
1 parent b6ee169 commit 76e062e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions nano/lib/thread_roles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions nano/lib/thread_roles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ enum class name
confirmation_height_notifications,
worker,
bootstrap_worker,
wallet_worker,
request_aggregator,
state_block_signature_verification,
epoch_upgrader,
Expand Down
7 changes: 6 additions & 1 deletion nano/node/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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);
});
}
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions nano/node/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class node final : public std::enable_shared_from_this<node>
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;
Expand Down

0 comments on commit 76e062e

Please sign in to comment.