Skip to content

Commit

Permalink
Removing usage of block_processor::flush from bootstrap_legacy and re…
Browse files Browse the repository at this point in the history
…moving bootstrap_processor::flush.
  • Loading branch information
clemahieu committed Jan 28, 2024
1 parent 07a92fe commit fabc862
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
11 changes: 0 additions & 11 deletions nano/node/blockprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@ void nano::block_processor::stop ()
nano::join_or_pass (processing_thread);
}

void nano::block_processor::flush ()
{
flushing = true;
nano::unique_lock<nano::mutex> lock{ mutex };
while (!stopped && (have_blocks () || active))
{
condition.wait (lock);
}
flushing = false;
}

std::size_t nano::block_processor::size ()
{
nano::unique_lock<nano::mutex> lock{ mutex };
Expand Down
1 change: 0 additions & 1 deletion nano/node/blockprocessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class block_processor final
public:
explicit block_processor (nano::node &, nano::write_database_queue &);
void stop ();
void flush ();
std::size_t size ();
bool full ();
bool half_full ();
Expand Down
8 changes: 4 additions & 4 deletions nano/node/bootstrap/bootstrap_legacy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,10 @@ void nano::bootstrap_attempt_legacy::run ()
condition.wait (lock, [&stopped = stopped, &pulling = pulling] { return stopped || pulling == 0; });
}

// Flushing may resolve forks which can add more pulls
lock.unlock ();
node->block_processor.flush ();
lock.lock ();
while (!stopped && node->block_processor.size () != 0)
{
condition.wait_for (lock, std::chrono::milliseconds{ 100 }, [this, node] { return stopped || node->block_processor.size () == 0; });
}

if (start_account.number () != std::numeric_limits<nano::uint256_t>::max ())
{
Expand Down

0 comments on commit fabc862

Please sign in to comment.