13 namespace blockchain_history {
27 template <
typename history_
object_type,
typename fill_result_functor>
28 void get_history(uint64_t from, uint32_t limit, fill_result_functor& funct)
const
32 FC_ASSERT(limit > 0,
"Limit must be greater than zero");
38 auto from_ = std::min((uint64_t)std::numeric_limits<int64_t>::max(), from);
39 for (
auto it = idx.lower_bound(from_); it != idx.end() && limit; ++it, --limit)
45 template <
typename history_
object_type>
46 std::vector<applied_operation>
get_history(uint64_t from, uint32_t limit)
const
48 std::vector<applied_operation>
result;
52 auto fill_funct = [&](
const history_object_type& hobj) {
result.emplace_back(db->get(hobj.op)); };
53 this->
template get_history<history_object_type>(from, limit, fill_funct);
61 : _impl(new detail::devcommittee_history_api_impl(ctx.app))
73 const auto db = _impl->_app.chain_database();
74 return db->with_read_lock(
80 const auto db = _impl->_app.chain_database();
87 const auto db = _impl->_app.chain_database();
88 return db->with_read_lock([&]() {
89 std::vector<applied_withdraw_operation>
result;
92 result.emplace_back(db->get(obj.op));
93 auto& applied_op =
result.back();
102 if (to_withdraw == 0u)
107 else if (!obj.progress.empty())
109 auto last_op = fc::raw::unpack<operation>(db->get(obj.progress.back()).serialized_op);
119 == proposal_operation::tag<development_committee_withdraw_vesting_operation>::value,
120 "The only proposal_virtual_operation which can be in withdraw progress is a "
121 "'development_committee_withdraw_vesting_operation' one");
127 if (obj.progress.size() > 1)
129 auto before_last_op_obj = db->get(*(obj.progress.rbegin() + 1));
130 auto before_last_op = fc::raw::unpack<operation>(before_last_op_obj.serialized_op);
138 for (
auto&
id : obj.progress)
140 auto op = fc::raw::unpack<operation>(db->get(
id).serialized_op);
std::shared_ptr< chain::database > chain_database() const
std::vector< applied_operation > get_history(uint64_t from, uint32_t limit) const
void get_history(uint64_t from, uint32_t limit, fill_result_functor &funct) const
devcommittee_history_api_impl(scorum::app::application &app)
scorum::app::application & _app
~devcommittee_history_api()
devcommittee_history_api(const scorum::app::api_context &ctx)
#define MAX_BLOCKCHAIN_HISTORY_DEPTH
std::vector< applied_operation > get_scr_to_scr_transfers(uint64_t from, uint32_t limit) const
std::vector< applied_withdraw_operation > get_sp_to_scr_transfers(uint64_t from, uint32_t limit) const
std::vector< applied_operation > get_history(uint64_t from, uint32_t limit) const
shared_multi_index_container< history_object_t, indexed_by< ordered_unique< tag< by_id >, member< history_object_t, typename history_object_t::id_type, &history_object_t::id > >, ordered_unique< tag< by_id_desc >, member< history_object_t, typename history_object_t::id_type, &history_object_t::id >, std::greater< typename history_object_t::id_type > >> > devcommittee_history_index
fc::safe< share_value_type > share_type
protocol::proposal_operation proposal_op