Skip to content

Commit

Permalink
Reduce number of db queries in get_call_orders API
Browse files Browse the repository at this point in the history
  • Loading branch information
abitmore committed Feb 12, 2019
1 parent 8047742 commit 50fd492
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions libraries/app/database_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1273,10 +1273,9 @@ vector<call_order_object> database_api_impl::get_call_orders(const std::string&
{
FC_ASSERT( limit <= 300 );

const asset_id_type asset_a_id = get_asset_from_string(a)->id;
const asset_object* mia = get_asset_from_string(a);
const auto& call_index = _db.get_index_type<call_order_index>().indices().get<by_collateral>();
const asset_object& mia = _db.get(asset_a_id);
price index_price = price::min( mia.bitasset_data(_db).options.short_backing_asset, mia.get_id() );
price index_price = price::min( mia->bitasset_data(_db).options.short_backing_asset, mia->get_id() );

vector< call_order_object> result;
auto itr_min = call_index.lower_bound(index_price);
Expand Down

0 comments on commit 50fd492

Please sign in to comment.