BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
Go to the documentation of this file.
32 namespace graphene {
namespace chain {
38 FC_ASSERT(HARDFORK_BSIP_40_PASSED(now),
"Custom active authorities are not yet enabled");
43 FC_ASSERT(config.valid(),
"Cannot use custom authorities yet: global configuration not set");
44 FC_ASSERT(op.
valid_to > now,
"Custom authority expiration must be in the future");
45 FC_ASSERT((op.
valid_to - now).to_seconds() <= config->max_custom_authority_lifetime_seconds,
46 "Custom authority lifetime exceeds maximum limit");
49 FC_ASSERT(operation_forked_in,
"Cannot create custom authority for operation which is not valid yet");
52 FC_ASSERT(restriction_count <= config->max_custom_authority_restrictions,
53 "Custom authority has more than the maximum number of restrictions");
56 account_weight_pair.first(d);
60 FC_ASSERT(std::distance(range.first, range.second) < config->max_custom_authorities_per_account,
61 "Cannot create custom authority: account already has maximum number");
63 FC_ASSERT(std::distance(range.first, range.second) < config->max_custom_authorities_per_account_op,
64 "Cannot create custom authority: account already has maximum number for this operation type");
81 obj.restrictions.insert(std::make_pair(obj.restriction_counter++, r));
95 "Custom authority update specifies an enabled flag, but flag is not changed");
102 "Custom authority update specifies a new valid from date, but date is not changed");
107 "Custom authority update specifies a new valid to date, but date is not changed");
110 "Custom authority lifetime exceeds maximum limit");
113 FC_ASSERT(valid_from < valid_to,
"Custom authority validity begin date must be before expiration date");
117 "Custom authority update specifies a new authentication authority, but authority is not changed");
118 for (
const auto& account_weight_pair : op.
new_auth->account_auths)
119 account_weight_pair.first(d);
123 FC_ASSERT(old_object->restrictions.count(id) == 1,
"Cannot remove restriction ID ${I}: ID not found",
130 "LOGIC ERROR: Restriction counter overlaps restrictions. Please report this error.");
132 "Unable to add restrictions: causes wraparound of restriction IDs");
136 size_t restriction_count = 0;
139 restriction_count += restriction_pair.second.restriction_count();
142 FC_ASSERT(restriction_count <= config->max_custom_authority_restrictions,
143 "Cannot update custom authority: updated authority would exceed the maximum number of restrictions");
160 obj.restrictions.erase(id);
163 obj.restrictions.insert(std::make_pair(obj.restriction_counter++, r));
#define FC_CAPTURE_AND_RETHROW(...)
time_point_sec valid_to
Expiration date for custom authority.
fc::static_variant< transfer_operation, limit_order_create_operation, limit_order_cancel_operation, call_order_update_operation, fill_order_operation, account_create_operation, account_update_operation, account_whitelist_operation, account_upgrade_operation, account_transfer_operation, asset_create_operation, asset_update_operation, asset_update_bitasset_operation, asset_update_feed_producers_operation, asset_issue_operation, asset_reserve_operation, asset_fund_fee_pool_operation, asset_settle_operation, asset_global_settle_operation, asset_publish_feed_operation, witness_create_operation, witness_update_operation, proposal_create_operation, proposal_update_operation, proposal_delete_operation, withdraw_permission_create_operation, withdraw_permission_update_operation, withdraw_permission_claim_operation, withdraw_permission_delete_operation, committee_member_create_operation, committee_member_update_operation, committee_member_update_global_parameters_operation, vesting_balance_create_operation, vesting_balance_withdraw_operation, worker_create_operation, custom_operation, assert_operation, balance_claim_operation, override_transfer_operation, transfer_to_blind_operation, blind_transfer_operation, transfer_from_blind_operation, asset_settle_cancel_operation, asset_claim_fees_operation, fba_distribute_operation, bid_collateral_operation, execute_bid_operation, asset_claim_pool_operation, asset_update_issuer_operation, htlc_create_operation, htlc_redeem_operation, htlc_redeemed_operation, htlc_extend_operation, htlc_refund_operation, custom_authority_create_operation, custom_authority_update_operation, custom_authority_delete_operation, ticket_create_operation, ticket_update_operation, liquidity_pool_create_operation, liquidity_pool_delete_operation, liquidity_pool_deposit_operation, liquidity_pool_withdraw_operation, liquidity_pool_exchange_operation, samet_fund_create_operation, samet_fund_delete_operation, samet_fund_update_operation, samet_fund_borrow_operation, samet_fund_repay_operation, credit_offer_create_operation, credit_offer_delete_operation, credit_offer_update_operation, credit_offer_accept_operation, credit_deal_repay_operation, credit_deal_expired_operation, liquidity_pool_update_operation, credit_deal_update_operation, limit_order_update_operation >::tag_type int64_t tag_type
restriction_predicate_function get_restriction_predicate(vector< restriction > rs, operation::tag_type op_type)
get_restriction_predicate Get a predicate function for the supplied restriction
void_result do_apply(const operation_type &op)
tracks the blockchain state in an extensible manner
account_id_type account
Account which is setting the custom authority; also pays the fee.
void clear_predicate_cache()
Clear the cache of the predicate function.
time_point_sec head_block_time() const
void_result do_evaluate(const operation_type &op)
void_result do_evaluate(const operation_type &op)
unsigned_int operation_type
Tag of the operation this custom authority can authorize.
Create a new custom authority.
optional< bool > new_enabled
Change to whether the custom authority is enabled or not.
chain_parameters parameters
void_result do_evaluate(const operation_type &op)
const T & create(F &&constructor)
optional< time_point_sec > new_valid_to
Change to the custom authority expiration date.
Tracks account custom authorities.
flat_set< uint16_t > restrictions_to_remove
Set of IDs of restrictions to remove.
authority auth
Authentication requirements for the custom authority.
flat_map< account_id_type, weight_type > account_auths
time_point_sec valid_from
Date when custom authority becomes active.
Delete a custom authority.
unsigned_int operation_type
void_result do_apply(const operation_type &op)
vector< restriction > restrictions_to_add
Vector of new restrictions.
const custom_authority_object * old_object
time_point_sec valid_from
size_t restriction_count() const
const object & get(object_id_type id) const
extension< ext > extensions
optional< authority > new_auth
Change to the authentication for the custom authority.
vector< restriction > restrictions
Restrictions on operations this custom authority can authenticate.
Update a custom authority.
uint16_t restriction_counter
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
flat_map< uint16_t, restriction > restrictions
bool enabled
Whether the custom authority is enabled or not.
The hardfork_visitor struct checks whether a given operation type has been hardforked in or not.
const global_property_object & get_global_properties() const
account_id_type account
Account which owns the custom authority to update; also pays the fee.
custom_authority_id_type authority_to_update
ID of the custom authority to update.
account_id_type account
Account which owns the custom authority to update; also pays the fee.
optional< time_point_sec > new_valid_from
Change to the custom authority begin date.
void remove(const object &obj)
const IndexType & get_index_type() const
const custom_authority_object * old_object
abstract base class for accessing objects indexed in various ways.
custom_authority_id_type authority_to_delete
ID of the custom authority to delete.
object_id_type do_apply(const operation_type &op)
void modify(const T &obj, const Lambda &m)
void for_each(list< Types... >, Callable c)
Invoke the provided callable with an argument wrapper<Type>() for each type in the list.