diff --git a/nano/node/blockprocessor.cpp b/nano/node/blockprocessor.cpp index feac38abe2..bc10d115c8 100644 --- a/nano/node/blockprocessor.cpp +++ b/nano/node/blockprocessor.cpp @@ -37,10 +37,9 @@ void nano::block_processor::context::set_result (result_t const & result) * block_processor */ -nano::block_processor::block_processor (nano::node & node_a, nano::store::write_queue & write_queue_a) : +nano::block_processor::block_processor (nano::node & node_a) : config{ node_a.config.block_processor }, node (node_a), - write_queue (write_queue_a), next_log (std::chrono::steady_clock::now ()) { batch_processed.add ([this] (auto const & items) { @@ -300,7 +299,7 @@ auto nano::block_processor::process_batch (nano::unique_lock & lock { processed_batch_t processed; - auto scoped_write_guard = write_queue.wait (nano::store::writer::process_batch); + auto scoped_write_guard = node.store.write_queue.wait (nano::store::writer::process_batch); auto transaction (node.store.tx_begin_write ({ tables::accounts, tables::blocks, tables::pending, tables::rep_weights })); nano::timer timer_l; diff --git a/nano/node/blockprocessor.hpp b/nano/node/blockprocessor.hpp index aa0f6c6767..2e01d591ca 100644 --- a/nano/node/blockprocessor.hpp +++ b/nano/node/blockprocessor.hpp @@ -19,7 +19,6 @@ class node; namespace nano::store { class write_transaction; -class write_queue; } namespace nano @@ -86,7 +85,7 @@ class block_processor final }; public: - block_processor (nano::node &, nano::store::write_queue &); + block_processor (nano::node &); ~block_processor (); void start (); @@ -127,7 +126,6 @@ class block_processor final private: // Dependencies block_processor_config const & config; nano::node & node; - nano::store::write_queue & write_queue; private: nano::fair_queue queue; diff --git a/nano/node/confirming_set.cpp b/nano/node/confirming_set.cpp index 9582381db5..f9c9101e57 100644 --- a/nano/node/confirming_set.cpp +++ b/nano/node/confirming_set.cpp @@ -4,9 +4,8 @@ #include #include -nano::confirming_set::confirming_set (nano::ledger & ledger, nano::store::write_queue & write_queue, std::chrono::milliseconds batch_time) : +nano::confirming_set::confirming_set (nano::ledger & ledger, std::chrono::milliseconds batch_time) : ledger{ ledger }, - write_queue{ write_queue }, batch_time{ batch_time } { } @@ -72,7 +71,7 @@ void nano::confirming_set::run () for (auto i = processing.begin (), n = processing.end (); !stopped && i != n;) { lock.unlock (); // Waiting for db write is potentially slow - auto guard = write_queue.wait (nano::store::writer::confirmation_height); + auto guard = ledger.store.write_queue.wait (nano::store::writer::confirmation_height); auto tx = ledger.store.tx_begin_write ({ nano::tables::confirmation_height }); lock.lock (); // Process items in the back buffer within a single transaction for a limited amount of time diff --git a/nano/node/confirming_set.hpp b/nano/node/confirming_set.hpp index aa14b37cc5..06feb52e11 100644 --- a/nano/node/confirming_set.hpp +++ b/nano/node/confirming_set.hpp @@ -14,10 +14,6 @@ namespace nano class block; class ledger; } -namespace nano::store -{ -class write_queue; -} namespace nano { @@ -30,7 +26,7 @@ class confirming_set final friend class confirmation_height_pruned_source_Test; public: - confirming_set (nano::ledger & ledger, nano::store::write_queue & write_queue, std::chrono::milliseconds batch_time = std::chrono::milliseconds{ 500 }); + confirming_set (nano::ledger & ledger, std::chrono::milliseconds batch_time = std::chrono::milliseconds{ 500 }); ~confirming_set (); // Adds a block to the set of blocks to be confirmed void add (nano::block_hash const & hash); @@ -48,7 +44,6 @@ class confirming_set final private: void run (); nano::ledger & ledger; - nano::store::write_queue & write_queue; std::chrono::milliseconds batch_time; std::unordered_set set; std::unordered_set processing; diff --git a/nano/node/node.cpp b/nano/node/node.cpp index 951af4bf8f..ad80e5e040 100644 --- a/nano/node/node.cpp +++ b/nano/node/node.cpp @@ -170,8 +170,8 @@ nano::node::node (std::shared_ptr io_ctx_a, std::filesy tcp_listener{ std::make_shared (network.port, *this, config.tcp_incoming_connections_max) }, application_path (application_path_a), port_mapping (*this), - block_processor (*this, store.write_queue), - confirming_set_impl{ std::make_unique (ledger, store.write_queue, config.confirming_set_batch_time) }, + block_processor (*this), + confirming_set_impl{ std::make_unique (ledger, config.confirming_set_batch_time) }, confirming_set{ *confirming_set_impl }, active_impl{ std::make_unique (*this, confirming_set, block_processor) }, active{ *active_impl },