Golos
Разработчикам Статистика Баунти Документация Партнеры Github
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
golos::chain::database Class Reference

tracks the blockchain state in an extensible manner More...

#include <database.hpp>

Inheritance diagram for golos::chain::database:

Public Types

enum  validation_steps {
  skip_nothing = 0, skip_witness_signature = 1 << 0, skip_transaction_signatures = 1 << 1, skip_transaction_dupe_check = 1 << 2,
  skip_fork_db = 1 << 3, skip_block_size_check = 1 << 4, skip_tapos_check = 1 << 5, skip_authority_check,
  skip_merkle_check = 1 << 7, skip_undo_history_check = 1 << 8, skip_witness_schedule_check = 1 << 9, skip_validate = 1 << 10,
  skip_validate_invariants = 1 << 11, skip_undo_block = 1 << 12, skip_block_log = 1 << 13
}
 

Public Member Functions

 database ()
 
 ~database ()
 
bool is_producing () const
 
void set_producing (bool p)
 
void open (const fc::path &data_dir, const fc::path &shared_mem_dir, uint64_t initial_supply=STEEMIT_INIT_SUPPLY, uint64_t shared_file_size=0, uint32_t chainbase_flags=0)
 Open a database, creating a new one if necessary. More...
 
void reindex (const fc::path &data_dir, const fc::path &shared_mem_dir, uint64_t shared_file_size=(1024l *1024l *1024l *8l))
 Rebuild object graph from block history and open detabase. More...
 
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. More...
 
void close (bool rewind=true)
 
asset< 0, 17, 0 > get_balance (account_name_type owner, asset_name_type asset_name) const
 Retrieve a particular account's balance in a given asset. More...
 
asset< 0, 17, 0 > get_balance (const account_object &owner, const asset_object &asset_obj) const
 This is an overloaded method. More...
 
bool is_authorized_asset (const account_object &acct, const asset_object &asset_obj) const
 
bool is_known_block (const block_id_type &id) const
 
bool is_known_transaction (const transaction_id_type &id) const
 
fc::sha256 get_pow_target () const
 
uint32_t get_pow_summary_target () const
 
block_id_type get_block_id_for_num (uint32_t block_num) const
 
block_id_type find_block_id_for_num (uint32_t block_num) const
 
optional< signed_block > fetch_block_by_id (const block_id_type &id) const
 
optional< signed_block > fetch_block_by_number (uint32_t num) const
 
const signed_transaction get_recent_transaction (const transaction_id_type &trx_id) const
 
vector< block_id_type > get_block_ids_on_fork (block_id_type head_of_fork) const
 
chain_id_type get_chain_id () const
 
const asset_objectget_asset (const asset_name_type &name) const
 
const asset_objectfind_asset (const asset_name_type &name) const
 
const asset_dynamic_data_objectget_asset_dynamic_data (const asset_name_type &name) const
 
const asset_dynamic_data_objectfind_asset_dynamic_data (const asset_name_type &name) const
 
const asset_bitasset_data_objectget_asset_bitasset_data (const asset_name_type &name) const
 
const asset_bitasset_data_objectfind_asset_bitasset_data (const asset_name_type &name) const
 
const proposal_objectget_proposal (const account_name_type &name, protocol::integral_id_type id) const
 
const proposal_objectfind_proposal (const account_name_type &name, protocol::integral_id_type id) const
 
const witness_objectget_witness (const account_name_type &name) const
 
const witness_objectfind_witness (const account_name_type &name) const
 
const account_objectget_account (const account_name_type &name) const
 
const account_objectfind_account (const account_name_type &name) const
 
const account_statistics_objectget_account_statistics (const account_name_type &name) const
 
const account_statistics_objectfind_account_statistics (const account_name_type &name) const
 
const comment_objectget_comment (const account_name_type &author, const shared_string &permlink) const
 
const comment_objectfind_comment (const account_name_type &author, const shared_string &permlink) const
 
const comment_objectget_comment (const account_name_type &author, const string &permlink) const
 
const comment_objectfind_comment (const account_name_type &author, const string &permlink) const
 
const category_objectget_category (const shared_string &name) const
 
const category_objectfind_category (const shared_string &name) const
 
const escrow_objectget_escrow (const account_name_type &name, uint32_t escrow_id) const
 
const escrow_objectfind_escrow (const account_name_type &name, uint32_t escrow_id) const
 
const limit_order_objectget_limit_order (const account_name_type &owner, integral_id_type id) const
 
const limit_order_objectfind_limit_order (const account_name_type &owner, integral_id_type id) const
 
const savings_withdraw_objectget_savings_withdraw (const account_name_type &owner, uint32_t request_id) const
 
const savings_withdraw_objectfind_savings_withdraw (const account_name_type &owner, uint32_t request_id) const
 
const dynamic_global_property_objectget_dynamic_global_properties () const
 
const node_property_objectget_node_properties () const
 
const feed_history_objectget_feed_history () const
 
const witness_schedule_objectget_witness_schedule_object () const
 
const hardfork_property_objectget_hardfork_property_object () const
 
const time_point_sec calculate_discussion_payout_time (const comment_object &comment) const
 
const reward_fund_objectget_reward_fund (const comment_object &c) const
 
void pay_fee (const account_object &a, asset< 0, 17, 0 > fee)
 
void old_update_account_bandwidth (const account_object &a, uint32_t trx_size, const bandwidth_type type)
 
bool update_account_bandwidth (const account_object &a, uint32_t trx_size, const bandwidth_type type)
 
void process_bids (const asset_bitasset_data_object &bad)
 
uint32_t witness_participation_rate () const
 
void add_checkpoints (const flat_map< uint32_t, block_id_type > &checkpts)
 
const flat_map< uint32_t, block_id_type > get_checkpoints () const
 
bool before_last_checkpoint () const
 
bool push_block (const signed_block &b, uint32_t skip=skip_nothing)
 
void push_transaction (const signed_transaction &trx, uint32_t skip=skip_nothing)
 
void _maybe_warn_multiple_production (uint32_t height) const
 
bool _push_block (const signed_block &b)
 
void _push_transaction (const signed_transaction &trx)
 
void push_proposal (const proposal_object &proposal)
 
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)
 
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)
 
void pop_block ()
 
void clear_pending ()
 
void notify_pre_apply_operation (operation_notification &note)
 
void notify_post_apply_operation (const operation_notification &note)
 
const void push_virtual_operation (const operation &op, bool force=false)
 
void notify_applied_block (const signed_block &block)
 
void notify_on_pending_transaction (const signed_transaction &tx)
 
void notify_on_applied_transaction (const signed_transaction &tx)
 
account_name_type get_scheduled_witness (uint32_t slot_num) const
 Get the witness scheduled for block production in a slot. More...
 
fc::time_point_sec get_slot_time (uint32_t slot_num) const
 
uint32_t get_slot_at_time (fc::time_point_sec when) const
 
std::pair< asset< 0, 17, 0 >, asset< 0, 17, 0 > > create_sbd (const account_object &to_account, asset< 0, 17, 0 > steem)
 
asset< 0, 17, 0 > create_vesting (const account_object &to_account, const asset< 0, 17, 0 > &steem)
 
void adjust_total_payout (const comment_object &a, const asset< 0, 17, 0 > &sbd, const asset< 0, 17, 0 > &curator_sbd_value, const asset< 0, 17, 0 > &beneficiary_value)
 
void adjust_liquidity_reward (const account_object &owner, const asset< 0, 17, 0 > &volume, bool is_bid)
 
void adjust_balance (const account_object &a, const asset< 0, 17, 0 > &delta)
 
void adjust_savings_balance (const account_object &a, const asset< 0, 17, 0 > &delta)
 
void adjust_supply (const asset< 0, 17, 0 > &delta, bool adjust_vesting=false)
 
void adjust_rshares2 (const comment_object &comment, fc::uint128_t old_rshares2, fc::uint128_t new_rshares2)
 
void update_owner_authority (const account_object &account, const authority &owner_authority)
 
asset< 0, 17, 0 > get_balance (const account_object &a, const asset_name_type &asset_name) const
 
asset< 0, 17, 0 > get_savings_balance (const account_object &a, const asset_name_type &asset_name) const
 
void adjust_proxied_witness_votes (const account_object &a, const std::array< share_type, STEEMIT_MAX_PROXY_RECURSION_DEPTH+1 > &delta, int depth=0)
 
void adjust_proxied_witness_votes (const account_object &a, share_type delta, int depth=0)
 
void adjust_witness_votes (const account_object &a, share_type delta)
 
void adjust_witness_vote (const witness_object &obj, share_type delta)
 
void clear_expired_witness_votes ()
 
void clear_witness_votes (const account_object &a)
 
void process_vesting_withdrawals ()
 
share_type pay_curators (const comment_object &c, share_type &max_rewards)
 
share_type cashout_comment_helper (utilities::comment_reward_context &ctx, const comment_object &comment)
 
void process_comment_cashout ()
 
void process_funds ()
 
void process_conversions ()
 
void process_savings_withdraws ()
 
void account_recovery_processing ()
 
void expire_escrow_ratification ()
 
void process_decline_voting_rights ()
 
void update_median_feed ()
 
asset< 0, 17, 0 > get_liquidity_reward () const
 
asset< 0, 17, 0 > get_content_reward () const
 
asset< 0, 17, 0 > get_producer_reward () const
 
void pay_witness ()
 
asset< 0, 17, 0 > get_curation_reward () const
 
asset< 0, 17, 0 > get_pow_reward () const
 
uint16_t get_curation_rewards_percent (const comment_object &c) const
 
share_type pay_reward_funds (share_type reward)
 
asset< 0, 17, 0 > get_payout_extension_cost (const comment_object &input_comment, const fc::time_point_sec &input_time) const
 
time_point_sec get_payout_extension_time (const comment_object &input_comment, const asset< 0, 17, 0 > &input_cost) const
 
asset< 0, 17, 0 > get_name_cost (const fc::fixed_string<> &name) const
 
void pay_liquidity_reward ()
 
asset< 0, 17, 0 > to_sbd (const asset< 0, 17, 0 > &steem) const
 
asset< 0, 17, 0 > to_steem (const asset< 0, 17, 0 > &sbd) const
 
time_point_sec head_block_time () const
 
uint32_t head_block_num () const
 
block_id_type head_block_id () const
 
node_property_objectnode_properties ()
 
uint32_t last_non_undoable_block_num () const
 
void initialize_evaluators ()
 
void set_custom_operation_interpreter (const std::string &id, std::shared_ptr< custom_operation_interpreter > registry)
 
std::shared_ptr< custom_operation_interpreterget_custom_json_evaluator (const std::string &id)
 
void initialize_indexes ()
 Reset the object graph in-memory. More...
 
void init_schema ()
 
void init_genesis (uint64_t initial_supply=STEEMIT_INIT_SUPPLY)
 
void validate_transaction (const signed_transaction &trx)
 
bool fill_order (const limit_order_object &order, const asset< 0, 17, 0 > &pays, const asset< 0, 17, 0 > &receives)
 
bool fill_order (const call_order_object &order, const asset< 0, 17, 0 > &pays, const asset< 0, 17, 0 > &receives)
 
bool fill_order (const force_settlement_object &settle, const asset< 0, 17, 0 > &pays, const asset< 0, 17, 0 > &receives)
 
bool check_call_orders (const asset_object &mia, bool enable_black_swan=true)
 
void pay_order (const account_object &receiver, const asset< 0, 17, 0 > &receives, const asset< 0, 17, 0 > &pays)
 
asset< 0, 17, 0 > calculate_market_fee (const asset_object &recv_asset, const asset< 0, 17, 0 > &trade_amount)
 
asset< 0, 17, 0 > pay_market_fees (const asset_object &recv_asset, const asset< 0, 17, 0 > &receives)
 
void perform_vesting_share_split (uint32_t magnitude)
 
void retally_comment_children ()
 
void retally_witness_votes ()
 
void retally_witness_vote_counts (bool force=false)
 
void retally_liquidity_weight ()
 
void update_virtual_supply ()
 
bool has_hardfork (uint32_t hardfork) const
 
void set_hardfork (uint32_t hardfork, bool process_now=true)
 
void validate_invariants () const
 
const std::string & get_json_schema () const
 
void set_flush_interval (uint32_t flush_blocks)
 
template<typename MultiIndexType >
void add_plugin_index ()
 
void globally_settle_asset (const asset_object &bitasset, const price< 0, 17, 0 > &settle_price)
 Market Helpers More...
 
void cancel_order (const force_settlement_object &order, bool create_virtual_op=true)
 
void cancel_order (const limit_order_object &order, bool create_virtual_op=true)
 
void revive_bitasset (const asset_object &bitasset)
 
void cancel_bid (const collateral_bid_object &bid, bool create_virtual_op=true)
 
void execute_bid (const collateral_bid_object &bid, share_type debt_covered, share_type collateral_from_fund, const price_feed< 0, 17, 0 > &current_feed)
 
bool apply_order (const limit_order_object &new_order_object, bool allow_black_swan=true)
 Process a new limit order through the markets. More...
 
int match (const limit_order_object &bid, const limit_order_object &ask, const price< 0, 17, 0 > &trade_price)
 
asset< 0, 17, 0 > match (const call_order_object &call, const force_settlement_object &settle, const price< 0, 17, 0 > &match_price, const asset< 0, 17, 0 > &max_settlement)
 

Public Attributes

bool _is_producing = false
 
bool _log_hardforks = true
 
fc::signal< void(const operation_notification &)> pre_apply_operation
 
fc::signal< void(const operation_notification &)> post_apply_operation
 
fc::signal< void(const signed_block &)> applied_block
 
fc::signal< void(const signed_transaction &)> on_pending_transaction
 
fc::signal< void(const signed_transaction &)> on_applied_transaction
 
std::deque< signed_transaction > _popped_tx
 

Protected Member Functions

void notify_changed_objects ()
 

Detailed Description

tracks the blockchain state in an extensible manner

Definition at line 48 of file database.hpp.

Member Enumeration Documentation

◆ validation_steps

Enumerator
skip_nothing 
skip_witness_signature 

used while reindexing

skip_transaction_signatures 

used by non-witness nodes

skip_transaction_dupe_check 

used while reindexing

skip_fork_db 

used while reindexing

skip_block_size_check 

used when applying locally generated transactions

skip_tapos_check 

used while reindexing – note this skips expiration check as well

skip_authority_check 

used while reindexing – disables any checking of authority on transactions

skip_merkle_check 

used while reindexing

skip_undo_history_check 

used while reindexing

skip_witness_schedule_check 

used while reindexing

skip_validate 

used prior to checkpoint, skips validate() call on transaction

skip_validate_invariants 

used to skip database invariant check on block application

skip_undo_block 

used to skip undo db on reindex

skip_block_log 

used to skip block logging on reindex

Definition at line 66 of file database.hpp.

Constructor & Destructor Documentation

◆ database()

golos::chain::database::database ( )

◆ ~database()

golos::chain::database::~database ( )

Member Function Documentation

◆ _generate_block()

signed_block golos::chain::database::_generate_block ( const fc::time_point_sec  when,
const account_name_type &  witness_owner,
const fc::ecc::private_key &  block_signing_private_key 
)

◆ _maybe_warn_multiple_production()

void golos::chain::database::_maybe_warn_multiple_production ( uint32_t  height) const

◆ _push_block()

bool golos::chain::database::_push_block ( const signed_block &  b)

◆ _push_transaction()

void golos::chain::database::_push_transaction ( const signed_transaction &  trx)

◆ account_recovery_processing()

void golos::chain::database::account_recovery_processing ( )

◆ add_checkpoints()

void golos::chain::database::add_checkpoints ( const flat_map< uint32_t, block_id_type > &  checkpts)

◆ add_plugin_index()

template<typename MultiIndexType >
void golos::chain::database::add_plugin_index ( )
inline

Definition at line 679 of file database.hpp.

◆ adjust_balance()

void golos::chain::database::adjust_balance ( const account_object a,
const asset< 0, 17, 0 > &  delta 
)

◆ adjust_liquidity_reward()

void golos::chain::database::adjust_liquidity_reward ( const account_object owner,
const asset< 0, 17, 0 > &  volume,
bool  is_bid 
)

◆ adjust_proxied_witness_votes() [1/2]

void golos::chain::database::adjust_proxied_witness_votes ( const account_object a,
const std::array< share_type, STEEMIT_MAX_PROXY_RECURSION_DEPTH+1 > &  delta,
int  depth = 0 
)

this updates the votes for witnesses as a result of account voting proxy changing

◆ adjust_proxied_witness_votes() [2/2]

void golos::chain::database::adjust_proxied_witness_votes ( const account_object a,
share_type  delta,
int  depth = 0 
)

this updates the votes for all witnesses as a result of account VESTS changing

◆ adjust_rshares2()

void golos::chain::database::adjust_rshares2 ( const comment_object comment,
fc::uint128_t  old_rshares2,
fc::uint128_t  new_rshares2 
)

This method updates total_reward_shares2 on DGPO, and children_rshares2 on comments, when a comment's rshares2 changes from old_rshares2 to new_rshares2. Maintaining invariants that children_rshares2 is the sum of all descendants' rshares2, and dgpo.total_reward_shares2 is the total number of rshares2 outstanding.

◆ adjust_savings_balance()

void golos::chain::database::adjust_savings_balance ( const account_object a,
const asset< 0, 17, 0 > &  delta 
)

◆ adjust_supply()

void golos::chain::database::adjust_supply ( const asset< 0, 17, 0 > &  delta,
bool  adjust_vesting = false 
)

◆ adjust_total_payout()

void golos::chain::database::adjust_total_payout ( const comment_object a,
const asset< 0, 17, 0 > &  sbd,
const asset< 0, 17, 0 > &  curator_sbd_value,
const asset< 0, 17, 0 > &  beneficiary_value 
)

◆ adjust_witness_vote()

void golos::chain::database::adjust_witness_vote ( const witness_object obj,
share_type  delta 
)

this updates the vote of a single witness as a result of a vote being added or removed

◆ adjust_witness_votes()

void golos::chain::database::adjust_witness_votes ( const account_object a,
share_type  delta 
)

this is called by adjust_proxied_witness_votes when account proxy to self

◆ apply_order()

bool golos::chain::database::apply_order ( const limit_order_object new_order_object,
bool  allow_black_swan = true 
)

Process a new limit order through the markets.

Parameters
orderThe new order to process
Returns
true if order was completely filled; false otherwise

This function takes a new limit order, and runs the markets attempting to match it with existing orders already on the books.

◆ before_last_checkpoint()

bool golos::chain::database::before_last_checkpoint ( ) const

◆ calculate_discussion_payout_time()

const time_point_sec golos::chain::database::calculate_discussion_payout_time ( const comment_object comment) const

◆ calculate_market_fee()

asset<0, 17, 0> golos::chain::database::calculate_market_fee ( const asset_object recv_asset,
const asset< 0, 17, 0 > &  trade_amount 
)

◆ cancel_bid()

void golos::chain::database::cancel_bid ( const collateral_bid_object bid,
bool  create_virtual_op = true 
)

◆ cancel_order() [1/2]

void golos::chain::database::cancel_order ( const force_settlement_object order,
bool  create_virtual_op = true 
)

◆ cancel_order() [2/2]

void golos::chain::database::cancel_order ( const limit_order_object order,
bool  create_virtual_op = true 
)

◆ cashout_comment_helper()

share_type golos::chain::database::cashout_comment_helper ( utilities::comment_reward_context ctx,
const comment_object comment 
)

◆ check_call_orders()

bool golos::chain::database::check_call_orders ( const asset_object mia,
bool  enable_black_swan = true 
)

Starting with the least collateralized orders, fill them if their call price is above the max(lowest bid,call_limit).

This method will return true if it filled a short or limit

Parameters
mia- the market issued asset that should be called.
enable_black_swan- when adjusting collateral, triggering a black swan is invalid and will throw if enable_black_swan is not set to true.
Returns
true if a margin call was executed.

◆ clear_expired_witness_votes()

void golos::chain::database::clear_expired_witness_votes ( )

◆ clear_pending()

void golos::chain::database::clear_pending ( )

◆ clear_witness_votes()

void golos::chain::database::clear_witness_votes ( const account_object a)

clears all vote records for a particular account but does not update the witness vote totals. Vote totals should be updated first via a call to adjust_proxied_witness_votes( a, -a.witness_vote_weight() )

◆ close()

void golos::chain::database::close ( bool  rewind = true)

◆ create_sbd()

std::pair<asset<0, 17, 0>, asset<0, 17, 0> > golos::chain::database::create_sbd ( const account_object to_account,
asset< 0, 17, 0 >  steem 
)

Converts STEEM into sbd and adds it to to_account while reducing the STEEM supply by STEEM and increasing the sbd supply by the specified amount.

Returns
the sbd created and deposited to_account, may return STEEM if there is no median feed

◆ create_vesting()

asset<0, 17, 0> golos::chain::database::create_vesting ( const account_object to_account,
const asset< 0, 17, 0 > &  steem 
)

Creates vesting steem values The ratio of total_vesting_shares / total_vesting_fund_steem should not change as the result of the user adding funds

V / C = (V+Vn) / (C+Cn)

Simplifies to Vn = (V * Cn ) / C

If Cn equals o.amount, then we must solve for Vn to know how many new vesting shares the user should receive.

128 bit math is requred due to multiplying of 64 bit numbers. This is done in asset and price.

Parameters
to_account- the account to receive the new vesting shares
STEEM- STEEM to be converted to vesting shares

◆ execute_bid()

void golos::chain::database::execute_bid ( const collateral_bid_object bid,
share_type  debt_covered,
share_type  collateral_from_fund,
const price_feed< 0, 17, 0 > &  current_feed 
)

◆ expire_escrow_ratification()

void golos::chain::database::expire_escrow_ratification ( )

◆ fetch_block_by_id()

optional<signed_block> golos::chain::database::fetch_block_by_id ( const block_id_type &  id) const

◆ fetch_block_by_number()

optional<signed_block> golos::chain::database::fetch_block_by_number ( uint32_t  num) const

◆ fill_order() [1/3]

bool golos::chain::database::fill_order ( const limit_order_object order,
const asset< 0, 17, 0 > &  pays,
const asset< 0, 17, 0 > &  receives 
)
Returns
true if the order was completely filled and thus freed.

◆ fill_order() [2/3]

bool golos::chain::database::fill_order ( const call_order_object order,
const asset< 0, 17, 0 > &  pays,
const asset< 0, 17, 0 > &  receives 
)

◆ fill_order() [3/3]

bool golos::chain::database::fill_order ( const force_settlement_object settle,
const asset< 0, 17, 0 > &  pays,
const asset< 0, 17, 0 > &  receives 
)

◆ find_account()

const account_object* golos::chain::database::find_account ( const account_name_type &  name) const

◆ find_account_statistics()

const account_statistics_object* golos::chain::database::find_account_statistics ( const account_name_type &  name) const

◆ find_asset()

const asset_object* golos::chain::database::find_asset ( const asset_name_type &  name) const

◆ find_asset_bitasset_data()

const asset_bitasset_data_object* golos::chain::database::find_asset_bitasset_data ( const asset_name_type &  name) const

◆ find_asset_dynamic_data()

const asset_dynamic_data_object* golos::chain::database::find_asset_dynamic_data ( const asset_name_type &  name) const

◆ find_block_id_for_num()

block_id_type golos::chain::database::find_block_id_for_num ( uint32_t  block_num) const

◆ find_category()

const category_object* golos::chain::database::find_category ( const shared_string name) const

◆ find_comment() [1/2]

const comment_object* golos::chain::database::find_comment ( const account_name_type &  author,
const shared_string permlink 
) const

◆ find_comment() [2/2]

const comment_object* golos::chain::database::find_comment ( const account_name_type &  author,
const string &  permlink 
) const

◆ find_escrow()

const escrow_object* golos::chain::database::find_escrow ( const account_name_type &  name,
uint32_t  escrow_id 
) const

◆ find_limit_order()

const limit_order_object* golos::chain::database::find_limit_order ( const account_name_type &  owner,
integral_id_type  id 
) const

◆ find_proposal()

const proposal_object* golos::chain::database::find_proposal ( const account_name_type &  name,
protocol::integral_id_type  id 
) const

◆ find_savings_withdraw()

const savings_withdraw_object* golos::chain::database::find_savings_withdraw ( const account_name_type &  owner,
uint32_t  request_id 
) const

◆ find_witness()

const witness_object* golos::chain::database::find_witness ( const account_name_type &  name) const

◆ generate_block()

signed_block golos::chain::database::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 
)

◆ get_account()

const account_object& golos::chain::database::get_account ( const account_name_type &  name) const

◆ get_account_statistics()

const account_statistics_object& golos::chain::database::get_account_statistics ( const account_name_type &  name) const

◆ get_asset()

const asset_object& golos::chain::database::get_asset ( const asset_name_type &  name) const

◆ get_asset_bitasset_data()

const asset_bitasset_data_object& golos::chain::database::get_asset_bitasset_data ( const asset_name_type &  name) const

◆ get_asset_dynamic_data()

const asset_dynamic_data_object& golos::chain::database::get_asset_dynamic_data ( const asset_name_type &  name) const

◆ get_balance() [1/3]

asset<0, 17, 0> golos::chain::database::get_balance ( account_name_type  owner,
asset_name_type  asset_name 
) const

Retrieve a particular account's balance in a given asset.

Parameters
ownerAccount whose balance should be retrieved
asset_nameID of the asset to get balance in
Returns
owner's balance in asset

◆ get_balance() [2/3]

asset<0, 17, 0> golos::chain::database::get_balance ( const account_object owner,
const asset_object asset_obj 
) const

This is an overloaded method.

◆ get_balance() [3/3]

asset<0, 17, 0> golos::chain::database::get_balance ( const account_object a,
const asset_name_type &  asset_name 
) const

◆ get_block_id_for_num()

block_id_type golos::chain::database::get_block_id_for_num ( uint32_t  block_num) const

◆ get_block_ids_on_fork()

vector<block_id_type> golos::chain::database::get_block_ids_on_fork ( block_id_type  head_of_fork) const

◆ get_category()

const category_object& golos::chain::database::get_category ( const shared_string name) const

◆ get_chain_id()

chain_id_type golos::chain::database::get_chain_id ( ) const

◆ get_checkpoints()

const flat_map<uint32_t, block_id_type> golos::chain::database::get_checkpoints ( ) const
inline

Definition at line 244 of file database.hpp.

◆ get_comment() [1/2]

const comment_object& golos::chain::database::get_comment ( const account_name_type &  author,
const shared_string permlink 
) const

◆ get_comment() [2/2]

const comment_object& golos::chain::database::get_comment ( const account_name_type &  author,
const string &  permlink 
) const

◆ get_content_reward()

asset<0, 17, 0> golos::chain::database::get_content_reward ( ) const

◆ get_curation_reward()

asset<0, 17, 0> golos::chain::database::get_curation_reward ( ) const

◆ get_curation_rewards_percent()

uint16_t golos::chain::database::get_curation_rewards_percent ( const comment_object c) const

◆ get_custom_json_evaluator()

std::shared_ptr<custom_operation_interpreter> golos::chain::database::get_custom_json_evaluator ( const std::string &  id)

◆ get_dynamic_global_properties()

const dynamic_global_property_object& golos::chain::database::get_dynamic_global_properties ( ) const

◆ get_escrow()

const escrow_object& golos::chain::database::get_escrow ( const account_name_type &  name,
uint32_t  escrow_id 
) const

◆ get_feed_history()

const feed_history_object& golos::chain::database::get_feed_history ( ) const

◆ get_hardfork_property_object()

const hardfork_property_object& golos::chain::database::get_hardfork_property_object ( ) const

◆ get_json_schema()

const std::string& golos::chain::database::get_json_schema ( ) const

◆ get_limit_order()

const limit_order_object& golos::chain::database::get_limit_order ( const account_name_type &  owner,
integral_id_type  id 
) const

◆ get_liquidity_reward()

asset<0, 17, 0> golos::chain::database::get_liquidity_reward ( ) const

◆ get_name_cost()

asset<0, 17, 0> golos::chain::database::get_name_cost ( const fc::fixed_string<> &  name) const

◆ get_node_properties()

const node_property_object& golos::chain::database::get_node_properties ( ) const

◆ get_payout_extension_cost()

asset<0, 17, 0> golos::chain::database::get_payout_extension_cost ( const comment_object input_comment,
const fc::time_point_sec &  input_time 
) const

◆ get_payout_extension_time()

time_point_sec golos::chain::database::get_payout_extension_time ( const comment_object input_comment,
const asset< 0, 17, 0 > &  input_cost 
) const

◆ get_pow_reward()

asset<0, 17, 0> golos::chain::database::get_pow_reward ( ) const

◆ get_pow_summary_target()

uint32_t golos::chain::database::get_pow_summary_target ( ) const

◆ get_pow_target()

fc::sha256 golos::chain::database::get_pow_target ( ) const

◆ get_producer_reward()

asset<0, 17, 0> golos::chain::database::get_producer_reward ( ) const

◆ get_proposal()

const proposal_object& golos::chain::database::get_proposal ( const account_name_type &  name,
protocol::integral_id_type  id 
) const

◆ get_recent_transaction()

const signed_transaction golos::chain::database::get_recent_transaction ( const transaction_id_type &  trx_id) const

◆ get_reward_fund()

const reward_fund_object& golos::chain::database::get_reward_fund ( const comment_object c) const

◆ get_savings_balance()

asset<0, 17, 0> golos::chain::database::get_savings_balance ( const account_object a,
const asset_name_type &  asset_name 
) const

◆ get_savings_withdraw()

const savings_withdraw_object& golos::chain::database::get_savings_withdraw ( const account_name_type &  owner,
uint32_t  request_id 
) const

◆ get_scheduled_witness()

account_name_type golos::chain::database::get_scheduled_witness ( uint32_t  slot_num) const

Get the witness scheduled for block production in a slot.

Emitted After a block has been applied and committed. The callback should not yield and should execute quickly. this signal is emitted any time an object is removed and contains a pointer to the last value of every object that was removed. slot_num always corresponds to a time in the future.

If slot_num == 1, returns the next scheduled witness. If slot_num == 2, returns the next scheduled witness after 1 block gap.

Use the get_slot_time() and get_slot_at_time() functions to convert between slot_num and timestamp.

Passing slot_num == 0 returns STEEMIT_NULL_WITNESS

◆ get_slot_at_time()

uint32_t golos::chain::database::get_slot_at_time ( fc::time_point_sec  when) const

Get the last slot which occurs AT or BEFORE the given time.

The return value is the greatest value N such that get_slot_time( N ) <= when.

If no such N exists, return 0.

◆ get_slot_time()

fc::time_point_sec golos::chain::database::get_slot_time ( uint32_t  slot_num) const

Get the time at which the given slot occurs.

If slot_num == 0, return time_point_sec().

If slot_num == N for N > 0, return the Nth next block-interval-aligned time greater than head_block_time().

◆ get_witness()

const witness_object& golos::chain::database::get_witness ( const account_name_type &  name) const

◆ get_witness_schedule_object()

const witness_schedule_object& golos::chain::database::get_witness_schedule_object ( ) const

◆ globally_settle_asset()

void golos::chain::database::globally_settle_asset ( const asset_object bitasset,
const price< 0, 17, 0 > &  settle_price 
)

Market Helpers

All margin positions are force closed at the swan price Collateral received goes into a force-settlement fund No new margin positions can be created for this asset No more price feed updates Force settlement happens without delay at the swan price, deducting from force-settlement fund No more asset updates may be issued.

◆ has_hardfork()

bool golos::chain::database::has_hardfork ( uint32_t  hardfork) const

◆ head_block_id()

block_id_type golos::chain::database::head_block_id ( ) const

◆ head_block_num()

uint32_t golos::chain::database::head_block_num ( ) const

◆ head_block_time()

time_point_sec golos::chain::database::head_block_time ( ) const

◆ init_genesis()

void golos::chain::database::init_genesis ( uint64_t  initial_supply = STEEMIT_INIT_SUPPLY)

◆ init_schema()

void golos::chain::database::init_schema ( )

◆ initialize_evaluators()

void golos::chain::database::initialize_evaluators ( )

◆ initialize_indexes()

void golos::chain::database::initialize_indexes ( )

Reset the object graph in-memory.

◆ is_authorized_asset()

bool golos::chain::database::is_authorized_asset ( const account_object acct,
const asset_object asset_obj 
) const

◆ is_known_block()

bool golos::chain::database::is_known_block ( const block_id_type &  id) const
Returns
true if the block is in our fork DB or saved to disk as part of the official chain, otherwise return false

◆ is_known_transaction()

bool golos::chain::database::is_known_transaction ( const transaction_id_type &  id) const

◆ is_producing()

bool golos::chain::database::is_producing ( ) const
inline

Definition at line 54 of file database.hpp.

◆ last_non_undoable_block_num()

uint32_t golos::chain::database::last_non_undoable_block_num ( ) const

◆ match() [1/2]

int golos::chain::database::match ( const limit_order_object bid,
const limit_order_object ask,
const price< 0, 17, 0 > &  trade_price 
)

Matches the two orders,

Returns
a bit field indicating which orders were filled (and thus removed)

0 - no orders were matched 1 - bid was filled 2 - ask was filled 3 - both were filled

◆ match() [2/2]

asset<0, 17, 0> golos::chain::database::match ( const call_order_object call,
const force_settlement_object settle,
const price< 0, 17, 0 > &  match_price,
const asset< 0, 17, 0 > &  max_settlement 
)
Returns
the amount of asset settled

◆ node_properties()

node_property_object& golos::chain::database::node_properties ( )

◆ notify_applied_block()

void golos::chain::database::notify_applied_block ( const signed_block &  block)

◆ notify_changed_objects()

void golos::chain::database::notify_changed_objects ( )
protected

◆ notify_on_applied_transaction()

void golos::chain::database::notify_on_applied_transaction ( const signed_transaction &  tx)

◆ notify_on_pending_transaction()

void golos::chain::database::notify_on_pending_transaction ( const signed_transaction &  tx)

◆ notify_post_apply_operation()

void golos::chain::database::notify_post_apply_operation ( const operation_notification note)

◆ notify_pre_apply_operation()

void golos::chain::database::notify_pre_apply_operation ( operation_notification note)

This method is used to track applied operations during the evaluation of a block, these operations should include any operation actually included in a transaction as well as any implied/virtual operations that resulted, such as filling an order. The applied operations are cleared after post_apply_operation.

◆ old_update_account_bandwidth()

void golos::chain::database::old_update_account_bandwidth ( const account_object a,
uint32_t  trx_size,
const bandwidth_type  type 
)

◆ open()

void golos::chain::database::open ( const fc::path &  data_dir,
const fc::path &  shared_mem_dir,
uint64_t  initial_supply = STEEMIT_INIT_SUPPLY,
uint64_t  shared_file_size = 0,
uint32_t  chainbase_flags = 0 
)

Open a database, creating a new one if necessary.

Opens a database in the specified directory. If no initialized database is found the database will be initialized with the default state.

Parameters
data_dirPath to open or create database in

◆ pay_curators()

share_type golos::chain::database::pay_curators ( const comment_object c,
share_type &  max_rewards 
)

This method will iterate through all comment_vote_objects and give them (max_rewards * weight) / c.total_vote_weight.

Returns
unclaimed rewards.

◆ pay_fee()

void golos::chain::database::pay_fee ( const account_object a,
asset< 0, 17, 0 >  fee 
)

Deducts fee from the account and the share supply

◆ pay_liquidity_reward()

void golos::chain::database::pay_liquidity_reward ( )

◆ pay_market_fees()

asset<0, 17, 0> golos::chain::database::pay_market_fees ( const asset_object recv_asset,
const asset< 0, 17, 0 > &  receives 
)

◆ pay_order()

void golos::chain::database::pay_order ( const account_object receiver,
const asset< 0, 17, 0 > &  receives,
const asset< 0, 17, 0 > &  pays 
)

◆ pay_reward_funds()

share_type golos::chain::database::pay_reward_funds ( share_type  reward)

◆ pay_witness()

void golos::chain::database::pay_witness ( )

◆ perform_vesting_share_split()

void golos::chain::database::perform_vesting_share_split ( uint32_t  magnitude)

◆ pop_block()

void golos::chain::database::pop_block ( )

Removes the most recent block from the database and undoes any changes it made.

◆ process_bids()

void golos::chain::database::process_bids ( const asset_bitasset_data_object bad)

◆ process_comment_cashout()

void golos::chain::database::process_comment_cashout ( )

◆ process_conversions()

void golos::chain::database::process_conversions ( )

Iterates over all conversion requests with a conversion date before the head block time and then converts them to/from steem/sbd at the current median price feed history price times the premium

◆ process_decline_voting_rights()

void golos::chain::database::process_decline_voting_rights ( )

◆ process_funds()

void golos::chain::database::process_funds ( )

Overall the network has an inflation rate of 102% of virtual steem per year 90% of inflation is directed to vesting shares 10% of inflation is directed to subjective proof of work voting 1% of inflation is directed to liquidity providers 1% of inflation is directed to block producers

This method pays out vesting and reward shares every block, and liquidity shares once per day. This method does not pay out witnesses.

◆ process_savings_withdraws()

void golos::chain::database::process_savings_withdraws ( )

◆ process_vesting_withdrawals()

void golos::chain::database::process_vesting_withdrawals ( )

◆ push_block()

bool golos::chain::database::push_block ( const signed_block &  b,
uint32_t  skip = skip_nothing 
)

◆ push_proposal()

void golos::chain::database::push_proposal ( const proposal_object proposal)
Exceptions
fc::exceptionif the proposed transaction fails to apply.

◆ push_transaction()

void golos::chain::database::push_transaction ( const signed_transaction &  trx,
uint32_t  skip = skip_nothing 
)

Attempts to push the transaction into the pending queue

When called to push a locally generated transaction, set the skip_block_size_check bit on the skip argument . This will allow the transaction to be pushed even if it causes the pending block size to exceed the maximum block si ze. Although the transaction will probably not propagate further now, as the peers are likely to have their pe nding queues full as well, it will be kept in the queue to be propagated later when a new block flushes out the pend ing queues.

◆ push_virtual_operation()

const void golos::chain::database::push_virtual_operation ( const operation &  op,
bool  force = false 
)
inline

◆ reindex()

void golos::chain::database::reindex ( const fc::path &  data_dir,
const fc::path &  shared_mem_dir,
uint64_t  shared_file_size = (1024l *1024l *1024l *8l) 
)

Rebuild object graph from block history and open detabase.

This method may be called after or instead of database::open, and will rebuild the object graph by replaying blockchain history. When this method exits successfully, the database will be open.

◆ retally_comment_children()

void golos::chain::database::retally_comment_children ( )

◆ retally_liquidity_weight()

void golos::chain::database::retally_liquidity_weight ( )

◆ retally_witness_vote_counts()

void golos::chain::database::retally_witness_vote_counts ( bool  force = false)

◆ retally_witness_votes()

void golos::chain::database::retally_witness_votes ( )

◆ revive_bitasset()

void golos::chain::database::revive_bitasset ( const asset_object bitasset)

◆ set_custom_operation_interpreter()

void golos::chain::database::set_custom_operation_interpreter ( const std::string &  id,
std::shared_ptr< custom_operation_interpreter registry 
)

◆ set_flush_interval()

void golos::chain::database::set_flush_interval ( uint32_t  flush_blocks)

◆ set_hardfork()

void golos::chain::database::set_hardfork ( uint32_t  hardfork,
bool  process_now = true 
)

◆ set_producing()

void golos::chain::database::set_producing ( bool  p)
inline

Definition at line 58 of file database.hpp.

◆ to_sbd()

asset<0, 17, 0> golos::chain::database::to_sbd ( const asset< 0, 17, 0 > &  steem) const

Helper method to return the current sbd value of a given amount of STEEM. Return 0 SBD if there isn't a current_median_history

◆ to_steem()

asset<0, 17, 0> golos::chain::database::to_steem ( const asset< 0, 17, 0 > &  sbd) const

◆ update_account_bandwidth()

bool golos::chain::database::update_account_bandwidth ( const account_object a,
uint32_t  trx_size,
const bandwidth_type  type 
)

Update an account's bandwidth and returns if the account had the requisite bandwidth for the trx

◆ update_median_feed()

void golos::chain::database::update_median_feed ( )

◆ update_owner_authority()

void golos::chain::database::update_owner_authority ( const account_object account,
const authority &  owner_authority 
)

◆ update_virtual_supply()

void golos::chain::database::update_virtual_supply ( )

◆ validate_invariants()

void golos::chain::database::validate_invariants ( ) const

◆ validate_transaction()

void golos::chain::database::validate_transaction ( const signed_transaction &  trx)

This method validates transactions without adding it to the pending state.

Exceptions
ifan error occurs

◆ wipe()

void golos::chain::database::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.

Parameters
include_blocksIf true, delete the raw chain as well as the database.

Will close the database before wiping. Database will be closed when this function returns.

◆ witness_participation_rate()

uint32_t golos::chain::database::witness_participation_rate ( ) const

Calculate the percent of block production slots that were missed in the past 128 blocks, not including the current block.

Member Data Documentation

◆ _is_producing

bool golos::chain::database::_is_producing = false

Definition at line 62 of file database.hpp.

◆ _log_hardforks

bool golos::chain::database::_log_hardforks = true

Definition at line 64 of file database.hpp.

◆ _popped_tx

std::deque<signed_transaction> golos::chain::database::_popped_tx

when popping a block, the transactions that were removed get cached here so they can be reapplied at the proper time

Definition at line 562 of file database.hpp.

◆ applied_block

fc::signal<void(const signed_block &)> golos::chain::database::applied_block

This signal is emitted after all operations and virtual operation for a block have been applied but before the get_applied_operations() are cleared.

You may not yield from this callback because the blockchain is holding the write lock and may be in an "inconstant state" until after it is released.

Definition at line 318 of file database.hpp.

◆ on_applied_transaction

fc::signal<void(const signed_transaction &)> golos::chain::database::on_applied_transaction

This signal is emitted any time a new transaction has been applied to the chain state.

Definition at line 330 of file database.hpp.

◆ on_pending_transaction

fc::signal<void(const signed_transaction &)> golos::chain::database::on_pending_transaction

This signal is emitted any time a new transaction is added to the pending block state.

Definition at line 324 of file database.hpp.

◆ post_apply_operation

fc::signal<void(const operation_notification &)> golos::chain::database::post_apply_operation

Definition at line 308 of file database.hpp.

◆ pre_apply_operation

fc::signal<void(const operation_notification &)> golos::chain::database::pre_apply_operation

This signal is emitted for plugins to process every operation after it has been fully applied.

Definition at line 307 of file database.hpp.


The documentation for this class was generated from the following file: