fix get_relative_account_history node api call
for issue https://github.com/bitshares/bitshares-core/issues/279 and as discussed in telegram with @abitmore.
This commit is contained in:
parent
175d3d22da
commit
13c3fa0af7
1 changed files with 17 additions and 13 deletions
|
|
@ -494,21 +494,25 @@ namespace graphene { namespace app {
|
||||||
FC_ASSERT(limit <= 100);
|
FC_ASSERT(limit <= 100);
|
||||||
vector<operation_history_object> result;
|
vector<operation_history_object> result;
|
||||||
if( start == 0 )
|
if( start == 0 )
|
||||||
start = account(db).statistics(db).total_ops;
|
start = account(db).statistics(db).total_ops;
|
||||||
else start = min( account(db).statistics(db).total_ops, start );
|
else
|
||||||
const auto& hist_idx = db.get_index_type<account_transaction_history_index>();
|
start = min( account(db).statistics(db).total_ops, start );
|
||||||
const auto& by_seq_idx = hist_idx.indices().get<by_seq>();
|
|
||||||
|
if( start >= stop && start > 0 )
|
||||||
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 )
|
|
||||||
{
|
{
|
||||||
result.push_back( itr->operation_id(db) );
|
const auto& hist_idx = db.get_index_type<account_transaction_history_index>();
|
||||||
--itr;
|
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 ) );
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
--itr;
|
||||||
|
result.push_back( itr->operation_id(db) );
|
||||||
|
}
|
||||||
|
while ( itr != itr_stop && result.size() < limit );
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue