Skip to content

Commit

Permalink
Avoid bootstrapping notifications from live traffic
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Nov 12, 2023
1 parent bcb323e commit 93da90f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions nano/node/bootstrap_ascending/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,18 @@ nano::bootstrap_ascending::service::service (nano::node_config & config_a, nano:
scoring{ config.bootstrap_ascending, config.network_params.network },
database_limiter{ config.bootstrap_ascending.database_requests_limit, 1.0 }
{
// TODO: This is called from a very congested blockprocessor thread. Offload this work to a dedicated processing thread
block_processor.batch_processed.add ([this] (auto const & batch) {
{
nano::lock_guard<nano::mutex> lock{ mutex };

auto transaction = ledger.store.tx_begin_read ();
for (auto const & [result, block, context] : batch)
{
debug_assert (block != nullptr);
inspect (transaction, result, *block);
// Do not try to unnecessarily bootstrap live traffic chains
if (context.source == nano::block_processor::block_source::bootstrap)
{
inspect (transaction, result, *block);
}
}
}

Expand Down Expand Up @@ -386,7 +388,7 @@ void nano::bootstrap_ascending::service::process (const nano::asc_pull_ack::bloc

for (auto & block : response.blocks)
{
block_processor.add (block);
block_processor.add (block, nano::block_processor::block_source::bootstrap);
}
nano::lock_guard<nano::mutex> lock{ mutex };
throttle.add (true);
Expand Down

0 comments on commit 93da90f

Please sign in to comment.