From a748d4cc1d62f71e6c7fe66dd84f906c6ae856f1 Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Thu, 8 Oct 2015 11:11:49 -0400 Subject: [PATCH] check for sortedness --- libraries/chain/db_maint.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libraries/chain/db_maint.cpp b/libraries/chain/db_maint.cpp index 20541344..0cf08ac1 100644 --- a/libraries/chain/db_maint.cpp +++ b/libraries/chain/db_maint.cpp @@ -48,8 +48,19 @@ template void database::perform_account_maintenance(std::tuple helpers) { const auto& idx = get_index_type().indices(); + bool is_sorted = true; + object_id_type last_id = object_id_type(); for( const account_object& a : idx ) + { + if( a.id < last_id ) + is_sorted = false; + last_id = a.id; detail::for_each(helpers, a, detail::gen_seq()); + } + if( !is_sorted ) + { + wlog( "perform_account_maintenance was unsorted" ); + } } /// @brief A visitor for @ref worker_type which calls pay_worker on the worker within