Skip to content

Commit

Permalink
Internally check if the block processor needs to drop blocks, rather …
Browse files Browse the repository at this point in the history
…than making it a requirement of the caller.

Adds a stat counter when the block_processor drops a block as this is new behavior.
  • Loading branch information
clemahieu committed Feb 28, 2023
1 parent 0526a8b commit cbca293
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions nano/node/blockprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ void nano::block_processor::add (std::shared_ptr<nano::block> const & block_a)

void nano::block_processor::add (nano::unchecked_info const & info_a)
{
if (full ())
{
node.stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::drop);
return;
}
auto const & block = info_a.block;
debug_assert (!node.network_params.work.validate_entry (*block));
if (block->type () == nano::block_type::state || block->type () == nano::block_type::open)
Expand All @@ -115,6 +120,11 @@ void nano::block_processor::add (nano::unchecked_info const & info_a)

void nano::block_processor::add_local (nano::unchecked_info const & info_a)
{
if (full ())
{
node.stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::drop);
return;
}
debug_assert (!node.network_params.work.validate_entry (*info_a.block));
state_block_signature_verification.add ({ info_a.block });
}
Expand Down

0 comments on commit cbca293

Please sign in to comment.