Skip to content

Commit 74c650d

Browse files
authored
Merge pull request #330 from oxarbitrage/issue328
for issue 328
2 parents 6f7fb42 + 50e535e commit 74c650d

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

libraries/app/database_api.cpp

+20-5
Original file line numberDiff line numberDiff line change
@@ -1031,9 +1031,16 @@ vector<call_order_object> database_api_impl::get_call_orders(asset_id_type a, ui
10311031
const auto& call_index = _db.get_index_type<call_order_index>().indices().get<by_price>();
10321032
const asset_object& mia = _db.get(a);
10331033
price index_price = price::min(mia.bitasset_data(_db).options.short_backing_asset, mia.get_id());
1034-
1035-
return vector<call_order_object>(call_index.lower_bound(index_price.min()),
1036-
call_index.lower_bound(index_price.max()));
1034+
1035+
vector< call_order_object> result;
1036+
auto itr_min = call_index.lower_bound(index_price.min());
1037+
auto itr_max = call_index.lower_bound(index_price.max());
1038+
while( itr_min != itr_max && result.size() < limit )
1039+
{
1040+
result.emplace_back(*itr_min);
1041+
++itr_min;
1042+
}
1043+
return result;
10371044
}
10381045

10391046
vector<force_settlement_object> database_api::get_settle_orders(asset_id_type a, uint32_t limit)const
@@ -1045,8 +1052,16 @@ vector<force_settlement_object> database_api_impl::get_settle_orders(asset_id_ty
10451052
{
10461053
const auto& settle_index = _db.get_index_type<force_settlement_index>().indices().get<by_expiration>();
10471054
const asset_object& mia = _db.get(a);
1048-
return vector<force_settlement_object>(settle_index.lower_bound(mia.get_id()),
1049-
settle_index.upper_bound(mia.get_id()));
1055+
1056+
vector<force_settlement_object> result;
1057+
auto itr_min = settle_index.lower_bound(mia.get_id());
1058+
auto itr_max = settle_index.upper_bound(mia.get_id());
1059+
while( itr_min != itr_max && result.size() < limit )
1060+
{
1061+
result.emplace_back(*itr_min);
1062+
++itr_min;
1063+
}
1064+
return result;
10501065
}
10511066

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

0 commit comments

Comments
 (0)