#310 refactor maintenance block #678

Merged
vampik merged 31 commits from feature/310-refactor-maintenance-block into feature/son-for-hive-voting 2022-04-12 17:11:22 +00:00
Showing only changes of commit 8bb452858c - Show all commits

View file

@ -2231,20 +2231,28 @@ public:
return sign_transaction( tx, broadcast );
} FC_CAPTURE_AND_RETHROW( (owner_account) ) }
//! Fixme - do we need to specify sidechain_type as params here?
map<string, son_id_type> list_active_sons()
{
try
{
//! Fixme - now only bitcoin, fix according to sidechain_type
const global_property_object& gpo = get_global_properties();
set<son_id_type> son_ids_set;
for(const auto& active_sidechain_type : active_sidechain_types)
{
std::transform(gpo.active_sons.at(active_sidechain_type).cbegin(), gpo.active_sons.at(active_sidechain_type).cend(),
std::inserter(son_ids_set, son_ids_set.end()),
[](const son_info &swi) {
return swi.son_id;
});
}
vector<son_id_type> son_ids;
son_ids.reserve(gpo.active_sons.at(sidechain_type::bitcoin).size());
std::transform(gpo.active_sons.at(sidechain_type::bitcoin).cbegin(), gpo.active_sons.at(sidechain_type::bitcoin).cend(),
std::inserter(son_ids, son_ids.end()),
[](const son_info& swi) {
return swi.son_id;
});
son_ids.reserve(son_ids_set.size());
for(const auto& son_id : son_ids_set)
{
son_ids.emplace_back(son_id);
}
std::vector<fc::optional<son_object>> son_objects = _remote_db->get_sons(son_ids);
vector<std::string> owners;
for(auto obj: son_objects)
@ -2267,6 +2275,7 @@ public:
FC_CAPTURE_AND_RETHROW()
}
//! Fixme - do we need to specify sidechain_type as params here?
map<son_id_type, string> get_son_network_status()
{
try