From 53271599a73f8e402299a252cf084c0966226331 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Sat, 27 May 2017 09:42:50 +0200 Subject: [PATCH] Call use_next_id to keep object ids consistent --- .../account_history/account_history_plugin.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libraries/plugins/account_history/account_history_plugin.cpp b/libraries/plugins/account_history/account_history_plugin.cpp index 44b55d56..a5f90ea0 100644 --- a/libraries/plugins/account_history/account_history_plugin.cpp +++ b/libraries/plugins/account_history/account_history_plugin.cpp @@ -65,6 +65,7 @@ class account_history_plugin_impl account_history_plugin& _self; flat_set _tracked_accounts; bool _partial_operations = false; + primary_index< simple_index< operation_history_object > >* _oho_index; }; account_history_plugin_impl::~account_history_plugin_impl() @@ -90,7 +91,11 @@ void account_history_plugin_impl::update_account_histories( const signed_block& if (_partial_operations) { - if( !o_op.valid() ) continue; + if( !o_op.valid() ) + { + _oho_index->use_next_id(); + continue; + } } else { @@ -169,6 +174,8 @@ void account_history_plugin_impl::update_account_histories( const signed_block& } } } + if (_partial_operations && ! oho.valid()) + _oho_index->use_next_id(); } } } // end namespace detail @@ -207,7 +214,7 @@ void account_history_plugin::plugin_set_program_options( void account_history_plugin::plugin_initialize(const boost::program_options::variables_map& options) { database().applied_block.connect( [&]( const signed_block& b){ my->update_account_histories(b); } ); - database().add_index< primary_index< simple_index< operation_history_object > > >(); + my->_oho_index = database().add_index< primary_index< simple_index< operation_history_object > > >(); database().add_index< primary_index< account_transaction_history_index > >(); LOAD_VALUE_SET(options, "track-account", my->_tracked_accounts, graphene::chain::account_id_type);