diff --git a/nano/lib/stats_enums.hpp b/nano/lib/stats_enums.hpp index 8281754014..200143ea20 100644 --- a/nano/lib/stats_enums.hpp +++ b/nano/lib/stats_enums.hpp @@ -203,6 +203,7 @@ enum class detail unchecked, local, forced, + election, // message specific not_a_type, diff --git a/nano/node/blockprocessor.cpp b/nano/node/blockprocessor.cpp index de314b20e9..544de7973c 100644 --- a/nano/node/blockprocessor.cpp +++ b/nano/node/blockprocessor.cpp @@ -51,7 +51,7 @@ nano::block_processor::block_processor (nano::node_config const & node_config, n case nano::block_source::local: return config.priority_local; default: - return 1; + return config.priority_system; } }; diff --git a/nano/node/blockprocessor.hpp b/nano/node/blockprocessor.hpp index 50ae78c2ef..1adec9ca62 100644 --- a/nano/node/blockprocessor.hpp +++ b/nano/node/blockprocessor.hpp @@ -24,6 +24,7 @@ enum class block_source unchecked, local, forced, + election, }; std::string_view to_string (block_source); @@ -47,6 +48,7 @@ class block_processor_config final size_t priority_live{ 1 }; size_t priority_bootstrap{ 8 }; size_t priority_local{ 16 }; + size_t priority_system{ 32 }; size_t batch_size{ 256 }; size_t max_queued_notifications{ 8 }; diff --git a/nano/node/election.cpp b/nano/node/election.cpp index 1e760bb938..ee64237059 100644 --- a/nano/node/election.cpp +++ b/nano/node/election.cpp @@ -399,7 +399,7 @@ void nano::election::confirm_if_quorum (nano::unique_lock & lock_a) { debug_assert (lock_a.owns_lock ()); auto tally_l (tally_impl ()); - debug_assert (!tally_l.empty ()); + release_assert (!tally_l.empty ()); auto winner (tally_l.begin ()); auto block_l (winner->second); auto const & winner_hash_l (block_l->hash ()); @@ -425,6 +425,8 @@ void nano::election::confirm_if_quorum (nano::unique_lock & lock_a) } if (final_weight >= node.online_reps.delta ()) { + // In some edge cases block might get rolled back while the election is confirming, reprocess it to ensure it's present in the ledger + node.block_processor.add (block_l, nano::block_source::election); confirm_once (lock_a); debug_assert (!lock_a.owns_lock ()); }