7 #include <scorum/chain/hardfork.hpp>
22 #include <fc/signals.hpp>
23 #include <fc/shared_string.hpp>
24 #include <fc/log/logger.hpp>
40 struct genesis_state_type;
41 struct genesis_persistent_state_type;
49 public data_service_factory,
107 void open(
const fc::path& data_dir,
108 const fc::path& shared_mem_dir,
109 uint64_t shared_file_size,
110 uint32_t chainbase_flags,
119 void reindex(
const fc::path& data_dir,
120 const fc::path& shared_mem_dir,
121 uint64_t shared_file_size,
131 void wipe(
const fc::path& data_dir,
const fc::path& shared_mem_dir,
bool include_blocks);
166 void add_checkpoints(
const flat_map<uint32_t, block_id_type>& checkpts);
180 const fc::ecc::private_key& block_signing_private_key,
317 void set_hardfork(uint32_t hardfork,
bool process_now =
true);
328 _plugin_index_signal.connect([
this]() { this->add_index<MultiIndexType>(); });
335 void update_witness_schedule();
336 void _reset_witness_virtual_schedule_time();
337 void _update_witness_median_props();
338 void _update_witness_majority_version();
339 void _update_witness_hardfork_version_votes();
341 void _maybe_warn_multiple_production(uint32_t height)
const;
344 signed_block _generate_block(
const fc::time_point_sec when,
346 const fc::ecc::private_key& block_signing_private_key);
379 std::unique_ptr<database_impl> _my;
381 bool _is_producing =
false;
384 optional<chainbase::abstract_undo_session_ptr> _pending_tx_session;
386 std::vector<signed_transaction> _pending_tx;
388 fc::time_point_sec _hardfork_times[SCORUM_NUM_HARDFORKS + 1];
393 fc::signal<void()> _plugin_index_signal;
396 uint32_t _current_block_num = 0;
397 uint16_t _current_trx_in_block = 0;
398 uint16_t _current_op_in_trx = 0;
400 flat_map<uint32_t, block_id_type> _checkpoints;
404 uint32_t _flush_blocks = 0;
405 uint32_t _next_flush_block = 0;
407 uint32_t _last_free_gb_printed = 0;
409 fc::time_point_sec _const_genesis_time;
tracks the blockchain state in an extensible manner
operation_notification create_notification(const operation &op) const
void set_producing(bool p)
block_id_type find_block_id_for_num(uint32_t block_num) const
void clear_expired_transactions()
void init_genesis(const genesis_state_type &genesis_state)
optional< signed_block > fetch_block_by_number(uint32_t num) const
void update_last_irreversible_block()
uint32_t get_reindex_skip_flags() const
void clear_expired_delegations()
void _apply_transaction(const signed_transaction &trx)
signed_block generate_block(const fc::time_point_sec when, const account_name_type &witness_owner, const fc::ecc::private_key &block_signing_private_key, uint32_t skip)
@ opt_notify_virtual_op_applying
uint32_t get_slot_at_time(fc::time_point_sec when) const
void apply_hardfork(uint32_t hardfork)
void set_flush_interval(uint32_t flush_blocks)
fc::signal< void(const signed_transaction &)> on_pending_transaction
const witness_object & validate_block_header(uint32_t skip, const signed_block &next_block) const
void notify_on_pending_transaction(const signed_transaction &tx)
time_point_sec head_block_time() const
void update_signing_witness(const witness_object &signing_witness, const signed_block &new_block)
const node_property_object & get_node_properties() const
chain_id_type get_chain_id() const
void _apply_block(const signed_block &next_block)
void notify_on_applied_transaction(const signed_transaction &tx)
time_point_sec get_genesis_time() const
account_name_type get_scheduled_witness(uint32_t slot_num) const
Get the witness scheduled for block production in a slot.
void apply_operation(const operation &op)
void validate_invariants() const
void notify_applied_block(const signed_block &block)
optional< signed_block > fetch_block_by_id(const block_id_type &id) const
void set_initial_timestamp(const genesis_state_type &genesis_state)
bool has_hardfork(uint32_t hardfork) const
void notify_pre_apply_operation(const operation_notification ¬e)
uint32_t witness_participation_rate() const
const flat_map< uint32_t, block_id_type > get_checkpoints() const
fc::signal< void(const signed_transaction &)> on_pre_apply_transaction
void init_hardforks(fc::time_point_sec genesis_time)
fc::signal< void(const signed_block &)> applied_block
fc::signal< void(const signed_block &)> pre_applied_block
void reindex(const fc::path &data_dir, const fc::path &shared_mem_dir, uint64_t shared_file_size, uint32_t skip_flags, const genesis_state_type &genesis_state)
Rebuild object graph from block history and open detabase.
static fc::path block_log_path(const fc::path &data_dir)
bool push_block(const signed_block &b, uint32_t skip=skip_nothing)
@ skip_undo_block
used to skip undo db on reindex
@ skip_authority_check
used while reindexing – disables any checking of authority on transactions
@ skip_validate
used prior to checkpoint, skips validate() call on transaction
@ skip_block_size_check
used when applying locally generated transactions
@ skip_merkle_check
used while reindexing
@ skip_transaction_dupe_check
used while reindexing
@ skip_witness_schedule_check
used while reindexing
@ skip_tapos_check
used while reindexing – note this skips expiration check as well
@ skip_witness_signature
used while reindexing
@ skip_block_log
used to skip block logging on reindex
@ skip_validate_invariants
used to skip database invariant check on block application
@ skip_transaction_signatures
used by non-witness nodes
@ skip_fork_db
used while reindexing
@ skip_undo_history_check
used while reindexing
void open(const fc::path &data_dir, const fc::path &shared_mem_dir, uint64_t shared_file_size, uint32_t chainbase_flags, const genesis_state_type &genesis_state)
Open a database, creating a new one if necessary.
void process_header_extensions(const signed_block &next_block)
void initialize_evaluators()
void _push_transaction(const signed_transaction &trx)
block_id_type head_block_id() const
void expire_escrow_ratification()
bool is_known_transaction(const transaction_id_type &id) const
fc::signal< void(const signed_transaction &)> on_applied_transaction
void create_block_summary(const signed_block &next_block)
void process_decline_voting_rights()
bool is_known_block(const block_id_type &id) const
bool is_producing() const
void push_virtual_operation(const operation &op)
void push_hf_operation(const operation &op)
void apply_transaction(const signed_transaction &trx, uint32_t skip=skip_nothing)
void account_recovery_processing()
node_property_object & node_properties()
void show_free_memory(bool force)
void notify_post_apply_operation(const operation_notification ¬e)
const genesis_persistent_state_type & genesis_persistent_state() const
block_info head_block_context() const
block_id_type get_block_id_for_num(uint32_t block_num) const
uint32_t last_non_undoable_block_num() const
std::deque< signed_transaction > _popped_tx
bool before_last_checkpoint() const
uint32_t head_block_num() const
void set_hardfork(uint32_t hardfork, bool process_now=true)
void validate_transaction(const signed_transaction &trx)
void notify_pre_applied_block(const signed_block &block)
void apply_block(const signed_block &next_block, uint32_t skip=skip_nothing)
std::vector< block_id_type > get_block_ids_on_fork(block_id_type head_of_fork) const
fc::signal< void(const operation_notification &)> post_apply_operation
void initialize_indexes()
Reset the object graph in-memory.
void update_global_dynamic_data(const signed_block &b)
fc::signal< void(const operation_notification &)> pre_apply_operation
void notify_on_pre_apply_transaction(const signed_transaction &tx)
void push_transaction(const signed_transaction &trx, uint32_t skip=skip_nothing)
const signed_transaction get_recent_transaction(const transaction_id_type &trx_id) const
const time_point_sec calculate_discussion_payout_time(const comment_object &comment) const
void add_checkpoints(const flat_map< uint32_t, block_id_type > &checkpts)
optional< signed_block > read_block_by_number(uint32_t num) const
void wipe(const fc::path &data_dir, const fc::path &shared_mem_dir, bool include_blocks)
wipe Delete database from disk, and potentially the raw chain as well.
fc::time_point_sec get_slot_time(uint32_t slot_num) const
Contains per-node database configuration.
fc::ripemd160 transaction_id_type
fc::static_variant< vote_operation, comment_operation, transfer_operation, transfer_to_scorumpower_operation, withdraw_scorumpower_operation, account_create_by_committee_operation, account_create_operation, account_create_with_delegation_operation, account_update_operation, witness_update_operation, account_witness_vote_operation, account_witness_proxy_operation, delete_comment_operation, comment_options_operation, set_withdraw_scorumpower_route_to_account_operation, set_withdraw_scorumpower_route_to_dev_pool_operation, prove_authority_operation, request_account_recovery_operation, recover_account_operation, change_recovery_account_operation, escrow_approve_operation, escrow_dispute_operation, escrow_release_operation, escrow_transfer_operation, decline_voting_rights_operation, delegate_scorumpower_operation, create_budget_operation, close_budget_operation, proposal_vote_operation, proposal_create_operation, atomicswap_initiate_operation, atomicswap_redeem_operation, atomicswap_refund_operation, close_budget_by_advertising_moderator_operation, update_budget_operation, create_game_operation, cancel_game_operation, update_game_markets_operation, update_game_start_time_operation, post_game_results_operation, post_bet_operation, cancel_pending_bets_operation, delegate_sp_from_reg_pool_operation, create_nft_operation, update_nft_meta_operation, create_game_round_operation, update_game_round_result_operation, adjust_nft_experience_operation, update_nft_name_operation, author_reward_operation, comment_benefficiary_reward_operation, comment_payout_update_operation, comment_reward_operation, curation_reward_operation, hardfork_operation, producer_reward_operation, active_sp_holders_reward_operation, return_scorumpower_delegation_operation, shutdown_witness_operation, witness_miss_block_operation, expired_contract_refund_operation, acc_finished_vesting_withdraw_operation, devpool_finished_vesting_withdraw_operation, acc_to_acc_vesting_withdraw_operation, devpool_to_acc_vesting_withdraw_operation, acc_to_devpool_vesting_withdraw_operation, devpool_to_devpool_vesting_withdraw_operation, proposal_virtual_operation, budget_outgo_operation, budget_owner_income_operation, active_sp_holders_reward_legacy_operation, budget_closing_operation, bets_matched_operation, game_status_changed_operation, bet_resolved_operation, bet_cancelled_operation, bet_restored_operation, bet_updated_operation > operation
fc::fixed_string_16 account_name_type
fc::ripemd160 block_id_type
uint64_t asset_symbol_type