Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for issue 328 #330

Merged
merged 2 commits into from
Jul 18, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions libraries/app/database_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1031,9 +1031,15 @@ vector<call_order_object> database_api_impl::get_call_orders(asset_id_type a, ui
const auto& call_index = _db.get_index_type<call_order_index>().indices().get<by_price>();
const asset_object& mia = _db.get(a);
price index_price = price::min(mia.bitasset_data(_db).options.short_backing_asset, mia.get_id());

return vector<call_order_object>(call_index.lower_bound(index_price.min()),
call_index.lower_bound(index_price.max()));

vector< call_order_object> result;
auto itr_min = call_index.lower_bound(index_price.min());
while( itr_min != call_index.lower_bound(index_price.max()) && result.size() < limit )
{
result.emplace_back(*itr_min);
++itr_min;
}
return result;
}

vector<force_settlement_object> database_api::get_settle_orders(asset_id_type a, uint32_t limit)const
Expand All @@ -1045,8 +1051,15 @@ vector<force_settlement_object> database_api_impl::get_settle_orders(asset_id_ty
{
const auto& settle_index = _db.get_index_type<force_settlement_index>().indices().get<by_expiration>();
const asset_object& mia = _db.get(a);
return vector<force_settlement_object>(settle_index.lower_bound(mia.get_id()),
settle_index.upper_bound(mia.get_id()));

vector<force_settlement_object> result;
auto itr_min = settle_index.lower_bound(mia.get_id());
while( itr_min != settle_index.upper_bound(mia.get_id()) && result.size() < limit )
{
result.emplace_back(*itr_min);
++itr_min;
}
return result;
}

vector<call_order_object> database_api::get_margin_positions( const account_id_type& id )const
Expand Down