Skip to content

Commit

Permalink
Increase base sequence to 1 to ensure lower_bound calcs work as inten…
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Vandeberg committed Oct 19, 2017
1 parent 37656b9 commit 068d90a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libraries/plugins/account_history/account_history_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ struct operation_visitor
}

auto hist_itr = hist_idx.lower_bound( boost::make_tuple( item, uint32_t(-1) ) );
uint32_t sequence = 0;
uint32_t sequence = 1;
if( hist_itr != hist_idx.end() && hist_itr->account == item )
sequence = hist_itr->sequence + 1;
sequence = hist_itr->sequence + 1;

_db.create<account_history_object>( [&]( account_history_object& ahist )
{
ahist.account = item;
Expand All @@ -111,7 +111,7 @@ struct operation_visitor
--seq_itr;

while( seq_itr->account == item
&& sequence - seq_itr->sequence > 30
&& sequence - seq_itr->sequence > 30
&& now - _db.get< operation_object >( seq_itr->op ).timestamp > fc::days(30) )
{
ilog( "Removing ${a}:${i}", ("a", item)("i", seq_itr->sequence) );
Expand Down

0 comments on commit 068d90a

Please sign in to comment.