From 8bb452858c970b4b704c4041c35cc30aacc4fd99 Mon Sep 17 00:00:00 2001 From: Vlad Dobromyslov Date: Fri, 8 Apr 2022 09:14:36 +0300 Subject: [PATCH] #339 - fix son_ids in list_active_sons --- libraries/wallet/wallet.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 0b1789a6..af121f07 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -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 list_active_sons() { try { - //! Fixme - now only bitcoin, fix according to sidechain_type - const global_property_object& gpo = get_global_properties(); + set 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_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> son_objects = _remote_db->get_sons(son_ids); vector 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 get_son_network_status() { try