diff --git a/nano/node/block_broadcast.cpp b/nano/node/block_broadcast.cpp index 2fb61e6a17..6cdd673c51 100644 --- a/nano/node/block_broadcast.cpp +++ b/nano/node/block_broadcast.cpp @@ -36,7 +36,7 @@ void nano::block_broadcast::observe (std::shared_ptr const & block, } else { - if (context.source != nano::block_source::bootstrap) + if (context.source != nano::block_source::bootstrap && context.source != nano::block_source::bootstrap_legacy) { // Block arrived from realtime traffic, do normal gossip. network.flood_block (block, nano::transport::buffer_drop_policy::limiter); diff --git a/nano/node/blockprocessor.cpp b/nano/node/blockprocessor.cpp index 8d762378f3..ddca2e8d57 100644 --- a/nano/node/blockprocessor.cpp +++ b/nano/node/blockprocessor.cpp @@ -222,7 +222,7 @@ bool nano::block_processor::have_blocks () return have_blocks_ready (); } -void nano::block_processor::add_impl (std::shared_ptr block, context ctx) +void nano::block_processor::add_impl (std::shared_ptr const & block, context ctx) { release_assert (ctx.source != nano::block_source::forced); { @@ -237,14 +237,6 @@ auto nano::block_processor::next () -> entry debug_assert (!mutex.try_lock ()); debug_assert (!blocks.empty () || !forced.empty ()); // This should be checked before calling next - if (!blocks.empty ()) - { - entry entry = std::move (blocks.front ()); - release_assert (entry.ctx.source != nano::block_source::forced); - blocks.pop_front (); - return entry; - } - if (!forced.empty ()) { entry entry = std::move (forced.front ()); @@ -253,6 +245,14 @@ auto nano::block_processor::next () -> entry return entry; } + if (!blocks.empty ()) + { + entry entry = std::move (blocks.front ()); + release_assert (entry.ctx.source != nano::block_source::forced); + blocks.pop_front (); + return entry; + } + release_assert (false, "next() called when no blocks are ready"); } diff --git a/nano/node/blockprocessor.hpp b/nano/node/blockprocessor.hpp index 65bb62e70c..4d9c222760 100644 --- a/nano/node/blockprocessor.hpp +++ b/nano/node/blockprocessor.hpp @@ -31,7 +31,7 @@ enum class block_source forced, }; -std::string_view to_string (nano::block_source); +std::string_view to_string (block_source); nano::stat::detail to_stat_detail (block_source); /** @@ -99,7 +99,7 @@ class block_processor final void queue_unchecked (store::write_transaction const &, nano::hash_or_account const &); processed_batch_t process_batch (nano::unique_lock &); entry next (); - void add_impl (std::shared_ptr block, context); + void add_impl (std::shared_ptr const & block, context); private: // Dependencies nano::node & node;