@@ -1031,9 +1031,16 @@ vector<call_order_object> database_api_impl::get_call_orders(asset_id_type a, ui
1031
1031
const auto & call_index = _db.get_index_type <call_order_index>().indices ().get <by_price>();
1032
1032
const asset_object& mia = _db.get (a);
1033
1033
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;
1037
1044
}
1038
1045
1039
1046
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
1045
1052
{
1046
1053
const auto & settle_index = _db.get_index_type <force_settlement_index>().indices ().get <by_expiration>();
1047
1054
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;
1050
1065
}
1051
1066
1052
1067
vector<call_order_object> database_api::get_margin_positions ( const account_id_type& id )const
0 commit comments