#270 get_committee_member_count() function

This commit is contained in:
Vlad Dobromyslov 2022-02-07 11:53:03 +03:00
parent 694ad96429
commit b3ee4f5cd7
2 changed files with 16 additions and 1 deletions

View file

@ -178,6 +178,7 @@ public:
vector<optional<committee_member_object>> get_committee_members(const vector<committee_member_id_type> &committee_member_ids) const;
fc::optional<committee_member_object> get_committee_member_by_account(const std::string account_id_or_name) const;
map<string, committee_member_id_type> lookup_committee_member_accounts(const string &lower_bound_name, uint32_t limit) const;
uint64_t get_committee_member_count() const;
// SON members
vector<optional<son_object>> get_sons(const vector<son_id_type> &son_ids) const;
@ -1723,6 +1724,14 @@ map<string, committee_member_id_type> 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<committee_member_index>().indices().size();
}
//////////////////////////////////////////////////////////////////////
// //
// SON members //

View file

@ -603,6 +603,11 @@ public:
*/
map<string, committee_member_id_type> 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<son_object> 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)