Skip to content

Commit

Permalink
Fix block processor add issue (#3252)
Browse files Browse the repository at this point in the history
Issue introduced with PR: 664a940
  • Loading branch information
SergiySW authored Apr 30, 2021
1 parent a0f9072 commit b8babf1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
17 changes: 3 additions & 14 deletions nano/node/blockprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,30 +103,19 @@ void nano::block_processor::add (std::shared_ptr<nano::block> const & block_a, u
add (info);
}

void nano::block_processor::add (nano::unchecked_info const & info_a, const bool push_front_preference_a)
void nano::block_processor::add (nano::unchecked_info const & info_a)
{
debug_assert (!nano::work_validate_entry (*info_a.block));
bool quarter_full (size () > node.flags.block_processor_full_size / 4);
if (info_a.verified == nano::signature_verification::unknown && (info_a.block->type () == nano::block_type::state || info_a.block->type () == nano::block_type::open || !info_a.account.is_zero ()))
{
state_block_signature_verification.add (info_a, false);
}
else if (push_front_preference_a && !quarter_full)
{
/* Push blocks from unchecked to front of processing deque to keep more operations with unchecked inside of single write transaction.
It's designed to help with realtime blocks traffic if block processor is not performing large task like bootstrap.
If deque is a quarter full then push back to allow other blocks processing. */
{
nano::lock_guard<nano::mutex> guard (mutex);
blocks.emplace_front (info_a, false);
}
condition.notify_all ();
}
else
{
{
nano::lock_guard<nano::mutex> guard (mutex);
blocks.emplace_front (info_a, false);
blocks.emplace_back (info_a, false);
}
condition.notify_all ();
}
Expand Down Expand Up @@ -583,7 +572,7 @@ void nano::block_processor::queue_unchecked (nano::write_transaction const & tra
{
node.store.unchecked_del (transaction_a, nano::unchecked_key (hash_or_account_a, info.block->hash ()));
}
add (info, true);
add (info);
}
node.gap_cache.erase (hash_or_account_a.hash);
}
Expand Down
2 changes: 1 addition & 1 deletion nano/node/blockprocessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class block_processor final
bool full ();
bool half_full ();
void add_local (nano::unchecked_info const & info_a, bool const = false);
void add (nano::unchecked_info const &, bool const = false);
void add (nano::unchecked_info const &);
void add (std::shared_ptr<nano::block> const &, uint64_t = 0);
void force (std::shared_ptr<nano::block> const &);
void update (std::shared_ptr<nano::block> const &);
Expand Down

0 comments on commit b8babf1

Please sign in to comment.