Merge pull request #280 from oxarbitrage/patch-9

fix get_relative_account_history node api call #279
This commit is contained in:
Abit 2017-05-10 01:56:58 +02:00 committed by GitHub
commit fb825774c0

View file

@ -495,20 +495,24 @@ namespace graphene { namespace app {
vector<operation_history_object> result;
if( start == 0 )
start = account(db).statistics(db).total_ops;
else start = min( account(db).statistics(db).total_ops, start );
else
start = min( account(db).statistics(db).total_ops, start );
if( start >= stop && start > 0 )
{
const auto& hist_idx = db.get_index_type<account_transaction_history_index>();
const auto& by_seq_idx = hist_idx.indices().get<by_seq>();
auto itr = by_seq_idx.upper_bound( boost::make_tuple( account, start ) );
auto itr_stop = by_seq_idx.lower_bound( boost::make_tuple( account, stop ) );
--itr;
while ( itr != itr_stop && result.size() < limit )
do
{
result.push_back( itr->operation_id(db) );
--itr;
result.push_back( itr->operation_id(db) );
}
while ( itr != itr_stop && result.size() < limit );
}
return result;
}