BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
Go to the documentation of this file.
46 namespace graphene {
namespace protocol {
struct predicate_result; } }
48 namespace graphene {
namespace chain {
52 class transaction_evaluation_state;
53 class proposal_object;
54 class operation_history_object;
55 class chain_property_object;
56 class witness_schedule_object;
58 class force_settlement_object;
59 class limit_order_object;
60 class collateral_bid_object;
61 class call_order_object;
107 const std::string& db_version );
125 void wipe(
const fc::path& data_dir,
bool include_blocks);
126 void close(
bool rewind =
true);
172 uint32_t update_witness_missed_blocks(
const signed_block& b );
174 void update_witness_schedule();
208 account_id_type account,
const operation& op,
223 bool force_by_collateral_index )
const;
231 void initialize_evaluators();
234 template<
typename EvaluatorType>
235 void register_evaluator()
237 const auto op_type = operation::tag<typename EvaluatorType::operation_type>::value;
238 FC_ASSERT( op_type >= 0,
"Negative operation type" );
239 FC_ASSERT( op_type < _operation_evaluators.size(),
240 "The operation type (${a}) must be smaller than the size of _operation_evaluators (${b})",
241 (
"a", op_type)(
"b", _operation_evaluators.size()) );
242 _operation_evaluators[op_type] = std::make_unique<op_evaluator_impl<EvaluatorType>>();
255 asset
get_balance(account_id_type owner, asset_id_type asset_id)
const;
257 asset
get_balance(
const account_object& owner,
const asset_object& asset_obj)
const;
291 uint32_t req_vesting_seconds,
293 account_id_type req_owner,
294 bool require_vesting );
318 bool check_margin_calls =
false );
321 bool create_virtual_op =
true,
322 bool skip_cancel_fee =
false );
323 void revive_bitasset(
const asset_object& bitasset,
const asset_bitasset_data_object& bad );
324 void cancel_bid(
const collateral_bid_object& bid,
bool create_virtual_op =
true);
326 share_type collateral_from_fund,
const price_feed& current_feed );
330 void cleanup_and_remove_limit_order(
const limit_order_object& order );
333 optional<limit_order_id_type> process_limit_order_on_fill(
const limit_order_object& order,
334 const asset& order_receives );
335 void _cancel_bids_and_revive_mpa(
const asset_object& bitasset,
const asset_bitasset_data_object& bad );
336 bool check_for_blackswan(
const asset_object& mia,
bool enable_black_swan =
true,
337 const asset_bitasset_data_object* bitasset_ptr =
nullptr );
338 template<
typename IndexType>
339 void globally_settle_asset_impl(
const asset_object& bitasset,
340 const price& settle_price,
341 const IndexType& call_index,
342 bool check_margin_calls =
false );
347 void individually_settle(
const asset_bitasset_data_object& bitasset,
const call_order_object& call_order );
351 bool match_force_settlements(
const asset_bitasset_data_object& bitasset );
363 asset match_impl(
const force_settlement_object& settle,
364 const call_order_object& call,
365 const price& match_price,
366 const asset_bitasset_data_object& bitasset,
367 const asset& max_settlement,
368 const price& fill_price,
369 bool is_margin_call =
false,
370 bool settle_order_is_taker =
true );
383 bool apply_order(
const limit_order_object& new_order_object );
396 const asset_bitasset_data_object& bitasset,
397 const asset_object& asset_obj );
400 bool for_new_limit_order =
false,
401 const asset_bitasset_data_object* bitasset_ptr =
nullptr,
402 bool mute_exceptions =
false,
403 bool skip_matching_settle_orders =
false );
433 const price& trade_price );
435 const price& trade_price );
437 const price& trade_price );
439 const price& trade_price );
451 const price& trade_price,
453 const price& call_pays_price);
456 const price& trade_price,
458 return match(taker, maker, trade_price, bitasset, trade_price);
473 asset match(
const force_settlement_object& settle,
474 const call_order_object& call,
475 const price& match_price,
476 const asset_bitasset_data_object& bitasset,
477 const asset& max_settlement,
478 const price& fill_price,
479 bool is_margin_call =
false );
490 asset match(
const call_order_object& call,
491 const force_settlement_object& settle,
492 const price& match_price,
493 const asset_bitasset_data_object& bitasset,
494 const asset& max_settlement,
495 const price& fill_price );
507 bool fill_limit_order(
const limit_order_object& order,
const asset& pays,
const asset& receives,
508 bool cull_if_small,
const price& fill_price,
const bool is_maker );
521 bool fill_call_order(
const call_order_object& order,
const asset& pays,
const asset& receives,
522 const price& fill_price,
const bool is_maker,
const asset& margin_fee,
523 bool reduce_current_supply =
true );
526 bool fill_call_order(
const call_order_object& order,
const asset& pays,
const asset& receives,
527 const price& fill_price,
const bool is_maker,
528 bool reduce_current_supply =
true )
530 return fill_call_order( order, pays, receives, fill_price, is_maker, asset(0, pays.asset_id),
531 reduce_current_supply );
534 bool fill_settle_order(
const force_settlement_object& settle,
const asset& pays,
const asset& receives,
535 const price& fill_price,
bool is_maker,
bool pay_force_settle_fee =
true );
539 void pay_order(
const account_object& receiver,
const asset& receives,
const asset& pays );
549 const bool& is_maker )
const;
550 asset
pay_market_fees(
const account_object* seller,
const asset_object& recv_asset,
const asset& receives,
551 const bool& is_maker,
const optional<asset>& calculated_market_fees = {});
570 void add_checkpoints(
const flat_map<uint32_t,block_id_type>& checkpts );
571 const flat_map<uint32_t,block_id_type>
get_checkpoints()
const {
return _checkpoints; }
586 witness_id_type witness_id,
593 witness_id_type witness_id,
647 fc::signal<void(
const vector<object_id_type>&,
686 template<
typename Trx>
687 void _precompute_parallel(
const Trx* trx,
const size_t count,
const uint32_t skip )
const;
696 vector< unique_ptr<op_evaluator> > _operation_evaluators;
698 template<
class Index>
699 vector<std::reference_wrapper<const typename Index::object_type>> sort_votable_objects(
size_t count)
const;
706 bool is_virtual =
true );
723 void update_witnesses(
fork_item& fork_entry )
const;
724 void create_block_summary(
const signed_block& next_block);
740 bool skip_median_update =
false );
742 void update_global_dynamic_data(
const signed_block& b,
const uint32_t missed_blocks );
744 void update_last_irreversible_block();
745 void clear_expired_transactions();
746 void clear_expired_proposals();
747 void clear_expired_orders();
748 void clear_expired_force_settlements();
749 void update_expired_feeds();
750 void update_core_exchange_rates();
751 void update_maintenance_flag(
bool new_maintenance_flag );
752 void update_withdraw_permissions();
753 void update_credit_offers_and_deals();
754 void clear_expired_htlcs();
762 void process_budget();
764 void perform_chain_maintenance(
const signed_block& next_block );
765 void update_active_witnesses();
766 void update_active_committee_members();
767 void update_worker_votes();
769 void process_bitassets();
772 void perform_account_maintenance( Type tally_helper );
776 vector< processed_transaction > _pending_tx;
796 vector<optional<operation_history_object> > _applied_ops;
802 uint16_t _current_trx_in_block = 0;
803 uint16_t _current_op_in_trx = 0;
804 uint32_t _current_virtual_op = 0;
806 vector<uint64_t> _vote_tally_buffer;
807 vector<uint64_t> _witness_count_histogram_buffer;
808 vector<uint64_t> _committee_count_histogram_buffer;
809 std::array<uint64_t,2> _total_voting_stake;
812 flat_map<uint32_t,block_id_type> _checkpoints;
818 bool _track_standby_votes =
true;
827 bool _opened =
false;
830 uint32_t _undo_session_nesting_depth = 0;
833 flat_set<asset_id_type> _issue_453_affected_assets;
void apply_force_settlement(const force_settlement_object &new_settlement, const asset_bitasset_data_object &bitasset, const asset_object &asset_obj)
Process a new force-settlement request.
@ skip_transaction_signatures
used by non-witness nodes
An order-perserving dictionary of variant's.
@ skip_tapos_check
used while reindexing – note this skips expiration check too
bool is_known_transaction(const transaction_id_type &id) const
Maintains global state information (committee_member list, current fees)
tracks the blockchain state in an extensible manner
const limit_order_object * find_settled_debt_order(const asset_id_type &a) const
const chain_id_type & get_chain_id() const
map< custom_authority_id_type, rejected_predicate > rejected_predicate_map
bool apply_order_before_hardfork_625(const limit_order_object &new_order_object)
Process a new limit order through the markets.
time_point_sec head_block_time() const
fc::time_point_sec _current_block_time
asset get_balance(account_id_type owner, asset_id_type asset_id) const
Retrieve a particular account's balance in a given asset.
contains all of the parameters necessary to calculate the fee for any operation
The price struct stores asset prices in the BitShares system.
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 >
void notify_changed_objects()
fc::ripemd160 transaction_id_type
void reindex(fc::path data_dir)
Rebuild object graph from block history and open detabase.
asset pay_market_fees(const account_object *seller, const asset_object &recv_asset, const asset &receives, const bool &is_maker, const optional< asset > &calculated_market_fees={})
vector< authority > get_viable_custom_authorities(account_id_type account, const operation &op, rejected_predicate_map *rejected_authorities=nullptr) const
Get a list of custom authorities which can validate the provided operation for the provided account.
void check_settled_debt_order(const asset_bitasset_data_object &bitasset)
Match the settled debt order of the specified asset as taker with other orders on the opposite side o...
void wipe(const fc::path &data_dir, bool include_blocks)
wipe Delete database from disk, and potentially the raw chain as well.
fc::signal< void(const vector< object_id_type > &, const vector< const object * > &, const flat_set< account_id_type > &)> removed_objects
tracks the parameters of an asset
void adjust_balance(account_id_type account, asset delta)
Adjust a particular account's balance in a given asset by a delta.
uint32_t _current_block_num
boost::signals2::signal< T > signal
bool check_call_orders(const asset_object &mia, bool enable_black_swan=true, bool for_new_limit_order=false, const asset_bitasset_data_object *bitasset_ptr=nullptr, bool mute_exceptions=false, bool skip_matching_settle_orders=false)
bool push_block(const signed_block &b, uint32_t skip=skip_nothing)
processed_transaction push_proposal(const proposal_object &proposal)
const vector< optional< operation_history_object > > & get_applied_operations() const
void apply_block(const signed_block &next_block, uint32_t skip=skip_nothing)
const flat_map< uint32_t, block_id_type > get_checkpoints() const
void notify_on_pending_transaction(const signed_transaction &tx)
fc::signal< void(const signed_block &)> applied_block
void notify_applied_block(const signed_block &block)
void set_applied_operation_result(uint32_t op_id, const operation_result &r)
processed_transaction _push_transaction(const precomputable_transaction &trx)
void deposit_witness_pay(const witness_object &wit, share_type amount)
helper to handle witness pay
const asset_object & get_core_asset() const
signed_block generate_block(const fc::time_point_sec when, witness_id_type witness_id, const fc::ecc::private_key &block_signing_private_key, uint32_t skip)
fc::signal< void(const signed_transaction &)> on_pending_transaction
fc::signal< void(const vector< object_id_type > &, const flat_set< account_id_type > &)> changed_objects
void cancel_limit_order(const limit_order_object &order, bool create_virtual_op=true, bool skip_cancel_fee=false)
an elliptic curve private key.
optional< signed_block > fetch_block_by_id(const block_id_type &id) const
void revive_bitasset(const asset_object &bitasset, const asset_bitasset_data_object &bad)
adds a signature to a transaction
block_id_type head_block_id() const
wraps boost::filesystem::path to provide platform independent path manipulation.
const node_property_object & get_node_properties() const
const fee_schedule & current_fee_schedule() const
void update_bitasset_current_feed(const asset_bitasset_data_object &bitasset, bool skip_median_update=false)
void cancel_bid(const collateral_bid_object &bid, bool create_virtual_op=true)
tracks the asset information that changes frequently
const asset_dynamic_data_object & get_core_dynamic_data() const
bool apply_order(const limit_order_object &new_order_object)
fc::time_point_sec get_slot_time(uint32_t slot_num) const
uint32_t witness_participation_rate() const
uint32_t push_applied_operation(const operation &op, bool is_virtual=true)
void execute_bid(const collateral_bid_object &bid, share_type debt_covered, share_type collateral_from_fund, const price_feed ¤t_feed)
fc::ripemd160 block_id_type
processed_transaction push_transaction(const precomputable_transaction &trx, uint32_t skip=skip_nothing)
Contains per-node database configuration.
void globally_settle_asset(const asset_object &bitasset, const price &settle_price, bool check_margin_calls=false)
contains properties that only apply to bitassets (market issued assets)
string to_pretty_string(const asset &a) const
bool before_last_checkpoint() const
std::vector< block_id_type > get_block_ids_on_fork(block_id_type head_of_fork) const
void open(const fc::path &data_dir, std::function< genesis_state_type()> genesis_loader, const std::string &db_version)
Open a database, creating a new one if necessary.
const chain_property_object & get_chain_properties() const
void deposit_market_fee_vesting_balance(const account_id_type &account_id, const asset &delta)
uint32_t head_block_num() const
uint32_t get_slot_at_time(fc::time_point_sec when) const
safe< int64_t > share_type
maintains a set of indexed objects that can be modified with multi-level rollback support
optional< vesting_balance_id_type > deposit_lazy_vesting(const optional< vesting_balance_id_type > &ovbid, share_type amount, uint32_t req_vesting_seconds, vesting_balance_type balance_type, account_id_type req_owner, bool require_vesting)
Helper to make lazy deposit to CDD VBO.
std::deque< precomputable_transaction > _popped_tx
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
processed_transaction validate_transaction(const signed_transaction &trx)
captures the result of evaluating the operations contained in the transaction
@ skip_witness_schedule_check
used while reindexing
asset get_market_fee_vesting_balance(const account_id_type &account_id, const asset_id_type &asset_id)
Retrieve a particular account's market fee vesting balance in a given asset.
uint32_t last_non_undoable_block_num() const
node_property_object & node_properties()
@ skip_block_size_check
used when applying locally generated transactions
Maintains global state information (committee_member list, current fees)
void deposit_cashback(const account_object &acct, share_type amount, bool require_vesting=true)
helper to handle cashback rewards
@ skip_merkle_check
used while reindexing
tracks debt and call price information
void initialize_indexes()
Reset the object graph in-memory.
const witness_schedule_object & get_witness_schedule_object() const
operation_result apply_operation(transaction_evaluation_state &eval_state, const operation &op, bool is_virtual=true)
const account_statistics_object & get_account_stats_by_owner(account_id_type owner) const
witness_id_type head_block_witness() const
void apply_debug_updates()
void enable_standby_votes_tracking(bool enable)
Enable or disable tracking of votes of standby witnesses and committee members.
generic_operation_result process_tickets()
const global_property_object & get_global_properties() const
@ skip_witness_signature
used while reindexing
const signed_transaction & get_recent_transaction(const transaction_id_type &trx_id) const
@ skip_assert_evaluation
used while reindexing
asset pay_force_settle_fees(const asset_object &collecting_asset, const asset &collat_receives)
block_id_type get_block_id_for_num(uint32_t block_num) const
optional< signed_block > fetch_block_by_number(uint32_t num) const
void cancel_settle_order(const force_settlement_object &order)
@ skip_transaction_dupe_check
used while reindexing
void debug_update(const fc::variant_object &update)
const dynamic_global_property_object & get_dynamic_global_properties() const
asset calculate_market_fee(const asset_object &trade_asset, const asset &trade_amount, const bool &is_maker) const
Calculate the market fee that is to be taken.
witness_id_type get_scheduled_witness(uint32_t slot_num) const
Get the witness scheduled for block production in a slot.
@ skip_undo_history_check
used while reindexing
tracks the approval of a partially approved transaction
const call_order_object * find_least_collateralized_short(const asset_bitasset_data_object &bitasset, bool force_by_collateral_index) const
void add_checkpoints(const flat_map< uint32_t, block_id_type > &checkpts)
an offer to sell an amount of an asset at a specified exchange rate by a certain time
fc::signal< void(const vector< object_id_type > &, const flat_set< account_id_type > &)> new_objects
bool is_known_block(const block_id_type &id) const
fc::future< void > precompute_parallel(const signed_block &block, const uint32_t skip=skip_nothing) const
uint8_t block_interval
interval in seconds between blocks
processed_transaction apply_transaction(const signed_transaction &trx, uint32_t skip=skip_nothing)
base for all database objects