Scorum
witness_schedule_initializator.cpp
Go to the documentation of this file.
3 
6 
8 
10 
11 namespace scorum {
12 namespace chain {
13 namespace genesis {
14 
16 {
17  witness_service_i& witness_service = ctx.services().witness_service();
18  witness_schedule_service_i& schedule_service = ctx.services().witness_schedule_service();
19 
20  FC_ASSERT(!schedule_service.is_exists());
21 
22  const std::vector<genesis_state_type::witness_type>& witness_candidates = ctx.genesis_state().witness_candidates;
23 
24  schedule_service.create([&](witness_schedule_object& wso) {
25  for (size_t i = 0; i < wso.current_shuffled_witnesses.size() && i < witness_candidates.size(); ++i)
26  {
27  FC_ASSERT(witness_service.is_exists(witness_candidates[i].name));
28 
29  wso.current_shuffled_witnesses[i] = witness_candidates[i].name;
30  }
31  });
32 }
33 }
34 }
35 }
const genesis_state_type & genesis_state() const
data_service_factory_i & services() const
fc::array< account_name_type, SCORUM_MAX_WITNESSES_LIMIT > current_shuffled_witnesses
Definition: asset.cpp:15
virtual bool is_exists() const =0
virtual const object_type & create(const modifier_type &modifier)=0
std::vector< witness_type > witness_candidates