Verify block work inside blockprocessor (#4164)
This commit is contained in:
parent
a60b60aa1f
commit
3e7e881e92
1 changed files with 15 additions and 4 deletions
|
|
@ -99,11 +99,17 @@ void nano::block_processor::add (nano::unchecked_info const & info_a)
|
||||||
{
|
{
|
||||||
if (full ())
|
if (full ())
|
||||||
{
|
{
|
||||||
node.stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::drop);
|
node.stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::overfill);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (node.network_params.work.validate_entry (*info_a.block)) // true => error
|
||||||
|
{
|
||||||
|
node.stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::insufficient_work);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto const & block = info_a.block;
|
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)
|
if (block->type () == nano::block_type::state || block->type () == nano::block_type::open)
|
||||||
{
|
{
|
||||||
state_block_signature_verification.add ({ block });
|
state_block_signature_verification.add ({ block });
|
||||||
|
|
@ -122,10 +128,15 @@ void nano::block_processor::add_local (nano::unchecked_info const & info_a)
|
||||||
{
|
{
|
||||||
if (full ())
|
if (full ())
|
||||||
{
|
{
|
||||||
node.stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::drop);
|
node.stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::overfill);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
debug_assert (!node.network_params.work.validate_entry (*info_a.block));
|
if (node.network_params.work.validate_entry (*info_a.block)) // true => error
|
||||||
|
{
|
||||||
|
node.stats.inc (nano::stat::type::blockprocessor, nano::stat::detail::insufficient_work);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
state_block_signature_verification.add ({ info_a.block });
|
state_block_signature_verification.add ({ info_a.block });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue