22 , _witness_schedule_svc(witness_schedule_svc)
23 , _chain_dba(chain_dba)
31 return get_by<by_name>(name);
33 FC_CAPTURE_AND_RETHROW((name))
38 return find_by<by_name>(name) !=
nullptr;
44 FC_ASSERT(idx.begin() != idx.end(),
"Empty witness_index by_vote_name.");
45 return (*idx.begin());
49 const std::string& url,
53 FC_ASSERT(
owner.size(),
"Witness 'owner_name' should not be empty.");
55 const auto& new_witness = create_internal(
owner, block_signing_key);
58 fc::from_string(w.
url, url);
69 const auto& new_witness = create_internal(
owner, block_signing_key);
87 const std::string& url,
92 fc::from_string(w.
url, url);
101 auto itr = vidx.lower_bound(boost::make_tuple(account.id,
witness_id_type()));
102 while (itr != vidx.end() && itr->account == account.id)
113 const auto& props = _dgp_svc.
get();
114 const auto& wso = _witness_schedule_svc.
get();
117 debug_log(ctx,
"updating votes for witness=${w}", (
"w", w.
owner));
127 FC_ASSERT(w.
votes <= props.total_scorumpower.amount,
"",
128 (
"w.votes", w.
votes)(
"props", props.total_scorumpower));
142 block_info dbs_witness::get_head_block_context()
144 const auto& dprop = _dgp_svc.
get();
145 block_info ctx(dprop.head_block_number, dprop.head_block_id.str(), dprop.time, dprop.current_witness);
dba::db_index & db_impl()
virtual const object_type & create(const modifier_type &modifier) override
virtual void update(const modifier_type &modifier) override
virtual const object_type & get() const override
virtual bool is_exists() const override
const witness_object & create_witness(const account_name_type &owner, const std::string &url, const public_key_type &block_signing_key, const chain_properties &props) override
void update_witness(const witness_object &witness, const std::string &url, const public_key_type &block_signing_key, const chain_properties &props) override
void adjust_witness_votes(const account_object &account, const share_type &delta) override
dbs_witness(dba::db_index &db, witness_schedule_service_i &, dynamic_global_property_service_i &, dba::db_accessor< chain_property_object > &)
const witness_object & get_top_witness() const override
const witness_object & create_initial_witness(const account_name_type &owner, const public_key_type &block_signing_key) override
void adjust_witness_vote(const witness_object &witness, const share_type &delta) override
chain_properties proposed_chain_props
time_point_sec hardfork_time_vote
public_key_type signing_key
witness_schedule_type schedule
#define debug_log(CTX, FORMAT,...)
fc::uint128 virtual_last_update
fc::uint128 virtual_position
fc::uint128 virtual_scheduled_time
shared_multi_index_container< witness_vote_object, indexed_by< ordered_unique< tag< by_id >, member< witness_vote_object, witness_vote_id_type, &witness_vote_object::id > >, ordered_unique< tag< by_account_witness >, composite_key< witness_vote_object, member< witness_vote_object, account_id_type, &witness_vote_object::account >, member< witness_vote_object, witness_id_type, &witness_vote_object::witness > >, composite_key_compare< std::less< account_id_type >, std::less< witness_id_type > > >, ordered_unique< tag< by_witness_account >, composite_key< witness_vote_object, member< witness_vote_object, witness_id_type, &witness_vote_object::witness >, member< witness_vote_object, account_id_type, &witness_vote_object::account > >, composite_key_compare< std::less< witness_id_type >, std::less< account_id_type > > > > > witness_vote_index
shared_multi_index_container< witness_object, indexed_by< ordered_unique< tag< by_id >, member< witness_object, witness_id_type, &witness_object::id > >, ordered_unique< tag< by_name >, member< witness_object, account_name_type, &witness_object::owner > >, ordered_unique< tag< by_vote_name >, composite_key< witness_object, member< witness_object, share_type, &witness_object::votes >, member< witness_object, account_name_type, &witness_object::owner > >, composite_key_compare< std::greater< share_type >, std::less< account_name_type > > >, ordered_unique< tag< by_schedule_time >, composite_key< witness_object, member< witness_object, fc::uint128, &witness_object::virtual_scheduled_time >, member< witness_object, witness_id_type, &witness_object::id > > > > > witness_index
fc::safe< share_value_type > share_type
fc::fixed_string_16 account_name_type
virtual const object_type & get() const =0
virtual fc::time_point_sec head_block_time() const =0