diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index a674250153..77407e1045 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -105,7 +105,7 @@ class database_api_impl : public std::enable_shared_from_this // Markets / feeds vector get_limit_orders(asset_id_type a, asset_id_type b, uint32_t limit)const; - vector get_account_limit_orders( const string& name_or_id, + vector get_account_limit_orders( const string& account_name_or_id, const string &base, const string "e, uint32_t limit, optional ostart_id, @@ -663,30 +663,21 @@ vector> database_api_impl::get_accounts(const vector database_api::get_account_limit_orders( const string& name_or_id, const string &base, +vector database_api::get_account_limit_orders( const string& account_name_or_id, const string &base, const string "e, uint32_t limit, optional ostart_id, optional ostart_price) { - return my->get_account_limit_orders( name_or_id, base, quote, limit, ostart_id, ostart_price ); + return my->get_account_limit_orders( account_name_or_id, base, quote, limit, ostart_id, ostart_price ); } -vector database_api_impl::get_account_limit_orders( const string& name_or_id, const string &base, +vector database_api_impl::get_account_limit_orders( const string& account_name_or_id, const string &base, const string "e, uint32_t limit, optional ostart_id, optional ostart_price) { FC_ASSERT( limit <= 101 ); vector results; - const account_object* account = nullptr; uint32_t count = 0; - if (std::isdigit(name_or_id[0])) - account = _db.find(fc::variant(name_or_id, 1).as(1)); - else - { - const auto& idx = _db.get_index_type().indices().get(); - auto itr = idx.find(name_or_id); - if (itr != idx.end()) - account = &*itr; - } + const account_object* account = get_account_from_string(account_name_or_id); if (account == nullptr) return results; diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index 488b10c35a..c0da5697e1 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -298,7 +298,7 @@ class database_api * was just canceled accidentally, in such case, the result orders' price may lower or equal to start_price, * but orders' id greater than start_id */ - vector get_account_limit_orders( const string& name_or_id, + vector get_account_limit_orders( const string& account_name_or_id, const string &base, const string "e, uint32_t limit = 101,