diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 563228b3..ae9a8d8a 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -178,6 +178,7 @@ public: vector> get_committee_members(const vector &committee_member_ids) const; fc::optional get_committee_member_by_account(const std::string account_id_or_name) const; map lookup_committee_member_accounts(const string &lower_bound_name, uint32_t limit) const; + uint64_t get_committee_member_count() const; // SON members vector> get_sons(const vector &son_ids) const; @@ -1723,6 +1724,14 @@ map database_api_impl::lookup_committee_member return committee_members_by_account_name; } +uint64_t database_api::get_committee_member_count() const { + return my->get_committee_member_count(); +} + +uint64_t database_api_impl::get_committee_member_count() const { + return _db.get_index_type().indices().size(); +} + ////////////////////////////////////////////////////////////////////// // // // SON members // diff --git a/libraries/app/include/graphene/app/database_api.hpp b/libraries/app/include/graphene/app/database_api.hpp index 836aa632..be62e44f 100644 --- a/libraries/app/include/graphene/app/database_api.hpp +++ b/libraries/app/include/graphene/app/database_api.hpp @@ -603,6 +603,11 @@ public: */ map lookup_committee_member_accounts(const string &lower_bound_name, uint32_t limit) const; + /** + * @brief Get the total number of committee_members registered with the blockchain + */ + uint64_t get_committee_member_count() const; + ///////////////// // SON members // ///////////////// @@ -625,7 +630,7 @@ public: /** * @brief Get the SON owned by a given account - * @param account The ID of the account whose SON should be retrieved + * @param account_id_or_name The ID of the account whose SON should be retrieved * @return The SON object, or null if the account does not have a SON */ fc::optional get_son_by_account(const std::string account_id_or_name) const; @@ -1094,6 +1099,7 @@ FC_API(graphene::app::database_api, (get_committee_members) (get_committee_member_by_account) (lookup_committee_member_accounts) + (get_committee_member_count) // SON members (get_sons)