From abfe2b05b674b8a975d4f04c6b1a4945b9fc4103 Mon Sep 17 00:00:00 2001 From: Wesley Shillingford Date: Wed, 4 Nov 2020 20:56:10 +0000 Subject: [PATCH] Remove debug_assert which is hit calling block_confirm (#3031) --- nano/node/confirmation_height_bounded.cpp | 15 +++------------ nano/node/confirmation_height_unbounded.cpp | 7 ------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/nano/node/confirmation_height_bounded.cpp b/nano/node/confirmation_height_bounded.cpp index 182df3b9..1bf09b19 100644 --- a/nano/node/confirmation_height_bounded.cpp +++ b/nano/node/confirmation_height_bounded.cpp @@ -529,19 +529,10 @@ void nano::confirmation_height_bounded::cement_blocks (nano::write_guard & scope // Bail if there was an error. This indicates that there was a fatal issue with the ledger // (the blocks probably got rolled back when they shouldn't have). release_assert (!error); - // Tests should check this already at the end, but not all blocks may have elections (e.g from manual calls to confirmation_height_processor::add), this should catch any inconsistencies on live/beta though - if (!network_params.network.is_dev_network ()) + if (!network_params.network.is_dev_network () && time_spent_cementing > maximum_batch_write_time) { - auto blocks_confirmed_stats = ledger.stats.count (nano::stat::type::confirmation_height, nano::stat::detail::blocks_confirmed); - auto observer_stats = ledger.stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::all, nano::stat::dir::out); - debug_assert (blocks_confirmed_stats == observer_stats); - - // Lower batch_write_size if it took too long to write that amount. - if (time_spent_cementing > maximum_batch_write_time) - { - // Reduce (unless we have hit a floor) - batch_write_size = std::max (minimum_batch_write_size, batch_write_size - amount_to_change); - } + // Reduce (unless we have hit a floor) + batch_write_size = std::max (minimum_batch_write_size, batch_write_size - amount_to_change); } debug_assert (pending_writes.empty ()); diff --git a/nano/node/confirmation_height_unbounded.cpp b/nano/node/confirmation_height_unbounded.cpp index 5b798d60..78738ad6 100644 --- a/nano/node/confirmation_height_unbounded.cpp +++ b/nano/node/confirmation_height_unbounded.cpp @@ -405,13 +405,6 @@ void nano::confirmation_height_unbounded::cement_blocks (nano::write_guard & sco notify_observers_callback (cemented_blocks); release_assert (!error); - // Tests should check this already at the end, but not all blocks may have elections (e.g from manual calls to confirmation_height_processor::add), this should catch any inconsistencies on live/beta though - if (!network_params.network.is_dev_network ()) - { - auto blocks_confirmed_stats = ledger.stats.count (nano::stat::type::confirmation_height, nano::stat::detail::blocks_confirmed); - auto observer_stats = ledger.stats.count (nano::stat::type::confirmation_observer, nano::stat::detail::all, nano::stat::dir::out); - debug_assert (blocks_confirmed_stats == observer_stats); - } debug_assert (pending_writes.empty ()); debug_assert (pending_writes_size == 0); timer.restart ();