BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
tracks the blockchain state in an extensible manner More...
#include <database.hpp>
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_block_size_check = 1 << 4, skip_tapos_check = 1 << 5, skip_merkle_check = 1 << 7, skip_assert_evaluation = 1 << 8, skip_undo_history_check = 1 << 9, skip_witness_schedule_check = 1 << 10 } |
enum | match_result_type { match_result_type::none_filled = 0, match_result_type::only_taker_filled = 1, match_result_type::only_maker_filled = 2, match_result_type::both_filled = 3 } |
Public Member Functions | |
database () | |
~database () override | |
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. More... | |
void | reindex (fc::path data_dir) |
Rebuild object graph from block history and open detabase. More... | |
void | wipe (const fc::path &data_dir, bool include_blocks) |
wipe Delete database from disk, and potentially the raw chain as well. More... | |
void | close (bool rewind=true) |
witness_id_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 |
uint32_t | witness_participation_rate () const |
const chain_id_type & | get_chain_id () const |
const asset_object & | get_core_asset () const |
const asset_dynamic_data_object & | get_core_dynamic_data () const |
const chain_property_object & | get_chain_properties () const |
const global_property_object & | get_global_properties () const |
const dynamic_global_property_object & | get_dynamic_global_properties () const |
const node_property_object & | get_node_properties () const |
const fee_schedule & | current_fee_schedule () const |
const account_statistics_object & | get_account_stats_by_owner (account_id_type owner) const |
const witness_schedule_object & | get_witness_schedule_object () const |
time_point_sec | head_block_time () const |
uint32_t | head_block_num () const |
block_id_type | head_block_id () const |
witness_id_type | head_block_witness () const |
node_property_object & | node_properties () |
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. More... | |
uint32_t | last_non_undoable_block_num () const |
const limit_order_object * | find_settled_debt_order (const asset_id_type &a) const |
const call_order_object * | find_least_collateralized_short (const asset_bitasset_data_object &bitasset, bool force_by_collateral_index) const |
asset | get_balance (account_id_type owner, asset_id_type asset_id) const |
Retrieve a particular account's balance in a given asset. More... | |
asset | get_balance (const account_object &owner, const asset_object &asset_obj) const |
This is an overloaded method. More... | |
void | adjust_balance (account_id_type account, asset delta) |
Adjust a particular account's balance in a given asset by a delta. More... | |
void | deposit_market_fee_vesting_balance (const account_id_type &account_id, const asset &delta) |
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. More... | |
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. More... | |
void | deposit_cashback (const account_object &acct, share_type amount, bool require_vesting=true) |
helper to handle cashback rewards More... | |
void | deposit_witness_pay (const witness_object &wit, share_type amount) |
helper to handle witness pay More... | |
string | to_pretty_string (const asset &a) const |
void | debug_dump () |
void | apply_debug_updates () |
void | debug_update (const fc::variant_object &update) |
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. More... | |
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) |
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 of the order book. More... | |
bool | is_known_block (const block_id_type &id) const |
bool | is_known_transaction (const transaction_id_type &id) const |
block_id_type | get_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 |
std::vector< block_id_type > | get_block_ids_on_fork (block_id_type head_of_fork) 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) |
processed_transaction | push_transaction (const precomputable_transaction &trx, uint32_t skip=skip_nothing) |
processed_transaction | _push_transaction (const precomputable_transaction &trx) |
processed_transaction | push_proposal (const proposal_object &proposal) |
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) |
void | pop_block () |
void | clear_pending () |
uint32_t | push_applied_operation (const operation &op, bool is_virtual=true) |
void | set_applied_operation_result (uint32_t op_id, const operation_result &r) |
const vector< optional< operation_history_object > > & | get_applied_operations () const |
fc::future< void > | precompute_parallel (const signed_block &block, const uint32_t skip=skip_nothing) const |
fc::future< void > | precompute_parallel (const precomputable_transaction &trx) const |
void | apply_block (const signed_block &next_block, uint32_t skip=skip_nothing) |
processed_transaction | apply_transaction (const signed_transaction &trx, uint32_t skip=skip_nothing) |
operation_result | apply_operation (transaction_evaluation_state &eval_state, const operation &op, bool is_virtual=true) |
void | enable_standby_votes_tracking (bool enable) |
Enable or disable tracking of votes of standby witnesses and committee members. More... | |
Public Member Functions inherited from graphene::db::object_database | |
object_database () | |
virtual | ~object_database ()=default |
void | reset_indexes () |
void | open (const fc::path &data_dir) |
void | flush () |
void | wipe (const fc::path &data_dir) |
void | close () |
template<typename T , typename F > | |
const T & | create (F &&constructor) |
const object & | get_object (const object_id_type &id) const |
const object * | find_object (const object_id_type &id) const |
template<typename T > | |
const T & | get (const object_id_type &id) const |
template<typename T > | |
const T * | find (const object_id_type &id) const |
template<uint8_t SpaceID, uint8_t TypeID> | |
auto | find (const object_id< SpaceID, TypeID > &id) const -> const object_downcast_t< decltype(id)> * |
template<uint8_t SpaceID, uint8_t TypeID> | |
auto | get (const object_id< SpaceID, TypeID > &id) const -> const object_downcast_t< decltype(id)> & |
template<typename IndexType > | |
IndexType * | add_index () |
template<typename IndexType , typename SecondaryIndexType , typename... Args> | |
SecondaryIndexType * | add_secondary_index (Args... args) |
void | pop_undo () |
fc::path | get_data_dir () const |
template<typename IndexType > | |
const IndexType & | get_index_type () const |
template<typename T > | |
const index & | get_index () const |
const index & | get_index (uint8_t space_id, uint8_t type_id) const |
const index & | get_index (const object_id_type &id) const |
const object & | insert (object &&obj) |
void | remove (const object &obj) |
template<typename T , typename Lambda > | |
void | modify (const T &obj, const Lambda &m) |
Public Attributes | |
fc::signal< void(const signed_block &)> | applied_block |
fc::signal< void(const signed_transaction &)> | on_pending_transaction |
fc::signal< void(const vector< object_id_type > &, const flat_set< account_id_type > &)> | new_objects |
fc::signal< void(const vector< object_id_type > &, const flat_set< account_id_type > &)> | changed_objects |
fc::signal< void(const vector< object_id_type > &, const vector< const object * > &, const flat_set< account_id_type > &)> | removed_objects |
fc::time_point_sec | _current_block_time |
uint32_t | _current_block_num = 0 |
Public Attributes inherited from graphene::db::object_database | |
undo_database | _undo_db |
Protected Member Functions | |
void | pop_undo () |
Protected Member Functions inherited from graphene::db::object_database | |
template<typename IndexType > | |
IndexType & | get_mutable_index_type () |
template<typename T > | |
index & | get_mutable_index () |
index & | get_mutable_index (const object_id_type &id) |
index & | get_mutable_index (uint8_t space_id, uint8_t type_id) |
void | initialize_indexes () |
Reset the object graph in-memory. More... | |
void | globally_settle_asset (const asset_object &bitasset, const price &settle_price, bool check_margin_calls=false) |
void | cancel_settle_order (const force_settlement_object &order) |
void | cancel_limit_order (const limit_order_object &order, bool create_virtual_op=true, bool skip_cancel_fee=false) |
void | revive_bitasset (const asset_object &bitasset, const asset_bitasset_data_object &bad) |
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 ¤t_feed) |
bool | apply_order_before_hardfork_625 (const limit_order_object &new_order_object) |
Process a new limit order through the markets. More... | |
bool | apply_order (const limit_order_object &new_order_object) |
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. More... | |
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={}) |
asset | pay_force_settle_fees (const asset_object &collecting_asset, const asset &collat_receives) |
std::deque< precomputable_transaction > | _popped_tx |
processed_transaction | validate_transaction (const signed_transaction &trx) |
generic_operation_result | process_tickets () |
void | update_bitasset_current_feed (const asset_bitasset_data_object &bitasset, bool skip_median_update=false) |
void | notify_applied_block (const signed_block &block) |
void | notify_on_pending_transaction (const signed_transaction &tx) |
void | notify_changed_objects () |
Additional Inherited Members | |
Static Public Member Functions inherited from graphene::db::object_database | |
template<typename T > | |
static const T & | cast (const object &obj) |
template<typename T > | |
static T & | cast (object &obj) |
Static Public Attributes inherited from graphene::db::object_database | |
static constexpr uint8_t | _index_size = 255 |
tracks the blockchain state in an extensible manner
Definition at line 70 of file database.hpp.
|
strong |
Enumerator | |
---|---|
none_filled | |
only_taker_filled | |
only_maker_filled | |
both_filled |
Definition at line 417 of file database.hpp.
Definition at line 77 of file database.hpp.
graphene::chain::database::database | ( | ) |
Definition at line 44 of file db_management.cpp.
|
override |
Definition at line 50 of file db_management.cpp.
processed_transaction graphene::chain::database::_push_transaction | ( | const precomputable_transaction & | trx | ) |
Definition at line 282 of file db_block.cpp.
void graphene::chain::database::add_checkpoints | ( | const flat_map< uint32_t, block_id_type > & | checkpts | ) |
Definition at line 858 of file db_block.cpp.
void graphene::chain::database::adjust_balance | ( | account_id_type | account, |
asset | delta | ||
) |
Adjust a particular account's balance in a given asset by a delta.
account | ID of account whose balance should be adjusted |
delta | Asset ID and amount to adjust balance by |
Definition at line 54 of file db_balance.cpp.
void graphene::chain::database::apply_block | ( | const signed_block & | next_block, |
uint32_t | skip = skip_nothing |
||
) |
Definition at line 573 of file db_block.cpp.
void graphene::chain::database::apply_debug_updates | ( | ) |
Definition at line 187 of file db_debug.cpp.
void graphene::chain::database::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.
new_settlement | The new force-settlement request |
bitasset | The bitasset data object |
asset_obj | The asset object |
Since the core-2481 hard fork, this function is called after a new force-settlement object is created to check if there are margin calls to be matched instantly.
Definition at line 943 of file db_market.cpp.
operation_result graphene::chain::database::apply_operation | ( | transaction_evaluation_state & | eval_state, |
const operation & | op, | ||
bool | is_virtual = true |
||
) |
Definition at line 784 of file db_block.cpp.
bool graphene::chain::database::apply_order | ( | const limit_order_object & | new_order_object | ) |
Definition at line 741 of file db_market.cpp.
bool graphene::chain::database::apply_order_before_hardfork_625 | ( | const limit_order_object & | new_order_object | ) |
Process a new limit order through the markets.
new_order_object | The new order to process |
This function takes a new limit order, and runs the markets attempting to match it with existing orders already on the books.
Definition at line 672 of file db_market.cpp.
processed_transaction graphene::chain::database::apply_transaction | ( | const signed_transaction & | trx, |
uint32_t | skip = skip_nothing |
||
) |
processed_transaction
is passed in, it is cast into signed_transaction
here. It also means that the operation_results
field is ignored by consensus, although it is a part of block data. Definition at line 688 of file db_block.cpp.
bool graphene::chain::database::before_last_checkpoint | ( | ) | const |
Definition at line 864 of file db_block.cpp.
asset graphene::chain::database::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.
trade_asset | the asset (passed in to avoid a lookup) |
trade_amount | the quantity that the fee calculation is based upon |
is_maker | TRUE if this is the fee for a maker, FALSE if taker |
Definition at line 2557 of file db_market.cpp.
void graphene::chain::database::cancel_bid | ( | const collateral_bid_object & | bid, |
bool | create_virtual_op = true |
||
) |
Definition at line 477 of file db_market.cpp.
void graphene::chain::database::cancel_limit_order | ( | const limit_order_object & | order, |
bool | create_virtual_op = true , |
||
bool | skip_cancel_fee = false |
||
) |
Definition at line 533 of file db_market.cpp.
void graphene::chain::database::cancel_settle_order | ( | const force_settlement_object & | order | ) |
Definition at line 524 of file db_market.cpp.
bool graphene::chain::database::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 |
||
) |
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
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. |
for_new_limit_order | - true if this function is called when matching call orders with a new limit order. (Only relevent before hardfork 625. apply_order_before_hardfork_625() is only function that calls this with for_new_limit_order true.) |
bitasset_ptr | - an optional pointer to the bitasset_data object of the asset |
mute_exceptions | - whether to mute exceptions in a special case |
skip_matching_settle_orders | - whether to skip matching call orders with force settlements |
Definition at line 2079 of file db_market.cpp.
void graphene::chain::database::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 of the order book.
bitasset | The bitasset data object |
Since the core-2591 hard fork, this function is called after processed all call orders in check_call_orders().
Definition at line 2504 of file db_market.cpp.
void graphene::chain::database::clear_pending | ( | ) |
Definition at line 541 of file db_block.cpp.
void graphene::chain::database::close | ( | bool | rewind = true | ) |
Definition at line 230 of file db_management.cpp.
const fee_schedule & graphene::chain::database::current_fee_schedule | ( | ) | const |
Definition at line 62 of file db_getter.cpp.
void graphene::chain::database::debug_dump | ( | ) |
This method dumps the state of the blockchain in a semi-human readable form for the purpose of tracking down funds and mismatches in currency allocation
Definition at line 41 of file db_debug.cpp.
void graphene::chain::database::debug_update | ( | const fc::variant_object & | update | ) |
Definition at line 197 of file db_debug.cpp.
void graphene::chain::database::deposit_cashback | ( | const account_object & | acct, |
share_type | amount, | ||
bool | require_vesting = true |
||
) |
helper to handle cashback rewards
Definition at line 202 of file db_balance.cpp.
optional< vesting_balance_id_type > graphene::chain::database::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.
If the given optional VBID is not valid(), or it does not have a CDD vesting policy, or the owner / vesting_seconds of the policy does not match the parameter, then credit amount to newly created VBID and return it.
Otherwise, credit amount to ovbid.
Definition at line 156 of file db_balance.cpp.
void graphene::chain::database::deposit_market_fee_vesting_balance | ( | const account_id_type & | account_id, |
const asset & | delta | ||
) |
Definition at line 127 of file db_balance.cpp.
void graphene::chain::database::deposit_witness_pay | ( | const witness_object & | wit, |
share_type | amount | ||
) |
helper to handle witness pay
Definition at line 249 of file db_balance.cpp.
|
inline |
Enable or disable tracking of votes of standby witnesses and committee members.
Definition at line 846 of file database.hpp.
void graphene::chain::database::execute_bid | ( | const collateral_bid_object & | bid, |
share_type | debt_covered, | ||
share_type | collateral_from_fund, | ||
const price_feed & | current_feed | ||
) |
Definition at line 492 of file db_market.cpp.
optional< signed_block > graphene::chain::database::fetch_block_by_id | ( | const block_id_type & | id | ) | const |
Definition at line 68 of file db_block.cpp.
optional< signed_block > graphene::chain::database::fetch_block_by_number | ( | uint32_t | num | ) | const |
Definition at line 76 of file db_block.cpp.
const call_order_object * graphene::chain::database::find_least_collateralized_short | ( | const asset_bitasset_data_object & | bitasset, |
bool | force_by_collateral_index | ||
) | const |
Find the call order with the least collateral ratio
bitasset | The bitasset object |
force_by_collateral_index | Whether to forcefully search via the by_collateral index |
Definition at line 161 of file db_getter.cpp.
const limit_order_object * graphene::chain::database::find_settled_debt_order | ( | const asset_id_type & | a | ) | const |
Find the limit order which is the individual settlement fund of the specified asset
a | ID of the asset |
Definition at line 152 of file db_getter.cpp.
signed_block graphene::chain::database::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 | ||
) |
Definition at line 382 of file db_block.cpp.
const account_statistics_object & graphene::chain::database::get_account_stats_by_owner | ( | account_id_type | owner | ) | const |
Definition at line 142 of file db_getter.cpp.
const vector< optional< operation_history_object > > & graphene::chain::database::get_applied_operations | ( | ) | const |
Definition at line 566 of file db_block.cpp.
asset graphene::chain::database::get_balance | ( | account_id_type | owner, |
asset_id_type | asset_id | ||
) | const |
Retrieve a particular account's balance in a given asset.
owner | Account whose balance should be retrieved |
asset_id | ID of the asset to get balance in |
Definition at line 35 of file db_balance.cpp.
asset graphene::chain::database::get_balance | ( | const account_object & | owner, |
const asset_object & | asset_obj | ||
) | const |
This is an overloaded method.
Definition at line 44 of file db_balance.cpp.
block_id_type graphene::chain::database::get_block_id_for_num | ( | uint32_t | block_num | ) | const |
Definition at line 63 of file db_block.cpp.
std::vector< block_id_type > graphene::chain::database::get_block_ids_on_fork | ( | block_id_type | head_of_fork | ) | const |
Definition at line 93 of file db_block.cpp.
const chain_id_type & graphene::chain::database::get_chain_id | ( | ) | const |
Definition at line 87 of file db_getter.cpp.
const chain_property_object & graphene::chain::database::get_chain_properties | ( | ) | const |
Definition at line 52 of file db_getter.cpp.
|
inline |
Definition at line 571 of file database.hpp.
const asset_object & graphene::chain::database::get_core_asset | ( | ) | const |
Definition at line 37 of file db_getter.cpp.
const asset_dynamic_data_object & graphene::chain::database::get_core_dynamic_data | ( | ) | const |
Definition at line 42 of file db_getter.cpp.
const dynamic_global_property_object & graphene::chain::database::get_dynamic_global_properties | ( | ) | const |
Definition at line 57 of file db_getter.cpp.
const global_property_object & graphene::chain::database::get_global_properties | ( | ) | const |
Definition at line 47 of file db_getter.cpp.
asset graphene::chain::database::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.
account_id | Account whose balance should be retrieved |
asset_id | ID of the asset to get balance in |
Definition at line 114 of file db_balance.cpp.
const node_property_object & graphene::chain::database::get_node_properties | ( | ) | const |
Definition at line 92 of file db_getter.cpp.
const signed_transaction & graphene::chain::database::get_recent_transaction | ( | const transaction_id_type & | trx_id | ) | const |
Definition at line 85 of file db_block.cpp.
witness_id_type graphene::chain::database::get_scheduled_witness | ( | uint32_t | slot_num | ) | const |
Get the witness scheduled for block production in a slot.
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 GRAPHENE_NULL_WITNESS
Definition at line 36 of file db_witness_schedule.cpp.
uint32_t graphene::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.
Definition at line 74 of file db_witness_schedule.cpp.
fc::time_point_sec graphene::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().
Definition at line 44 of file db_witness_schedule.cpp.
vector< authority > graphene::chain::database::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.
account | The account whose authority is required |
op | The operation requring the specified account's authority |
rejected_authorities | [Optional] A pointer to a map that should be populated with the custom authorities which were valid, but rejected because the operation did not comply with the restrictions |
Definition at line 102 of file db_getter.cpp.
const witness_schedule_object & graphene::chain::database::get_witness_schedule_object | ( | ) | const |
Definition at line 147 of file db_getter.cpp.
void graphene::chain::database::globally_settle_asset | ( | const asset_object & | mia, |
const price & | settlement_price, | ||
bool | check_margin_calls = false |
||
) |
Globally settle bitasset
at settle_price
, let margin calls pay a premium and margin call fee if check_margin_calls
is true
(in this case others would be closed not at settle_price
but at a price better for their owners).
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 Force settlement happens without delay at the swan price, deducting from force-settlement fund
Definition at line 221 of file db_market.cpp.
block_id_type graphene::chain::database::head_block_id | ( | ) | const |
Definition at line 77 of file db_getter.cpp.
uint32_t graphene::chain::database::head_block_num | ( | ) | const |
Definition at line 72 of file db_getter.cpp.
time_point_sec graphene::chain::database::head_block_time | ( | ) | const |
Definition at line 67 of file db_getter.cpp.
witness_id_type graphene::chain::database::head_block_witness | ( | ) | const |
void graphene::chain::database::initialize_indexes | ( | ) |
Reset the object graph in-memory.
db_init.cpp ////////////////////
Definition at line 154 of file db_init.cpp.
bool graphene::chain::database::is_known_block | ( | const block_id_type & | id | ) | const |
Definition at line 48 of file db_block.cpp.
bool graphene::chain::database::is_known_transaction | ( | const transaction_id_type & | id | ) | const |
Only return true if the transaction has not expired or been invalidated. If this method is called with a VERY old transaction we will return false, they should query things by blocks if they are that old.
Definition at line 57 of file db_block.cpp.
uint32_t graphene::chain::database::last_non_undoable_block_num | ( | ) | const |
Definition at line 130 of file db_getter.cpp.
node_property_object & graphene::chain::database::node_properties | ( | ) |
Definition at line 97 of file db_getter.cpp.
|
protected |
Definition at line 582 of file db_notify.cpp.
|
protected |
Definition at line 592 of file db_notify.cpp.
|
protected |
Definition at line 587 of file db_notify.cpp.
void graphene::chain::database::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.
Opens a database in the specified directory. If no initialized database is found, genesis_loader is called and its return value is used as the genesis state when initializing the new database
genesis_loader will not be called if an existing database is found.
data_dir | Path to open or create database in |
genesis_loader | A callable object which returns the genesis state to initialize new databases on |
db_version | a version string that changes when the internal database format and/or logic is modified |
Definition at line 176 of file db_management.cpp.
asset graphene::chain::database::pay_force_settle_fees | ( | const asset_object & | collecting_asset, |
const asset & | collat_receives | ||
) |
Definition at line 2702 of file db_market.cpp.
asset graphene::chain::database::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 = {} |
||
) |
Definition at line 2592 of file db_market.cpp.
void graphene::chain::database::pop_block | ( | ) |
Removes the most recent block from the database and undoes any changes it made.
Definition at line 523 of file db_block.cpp.
|
inlineprotected |
Definition at line 692 of file database.hpp.
fc::future< void > graphene::chain::database::precompute_parallel | ( | const precomputable_transaction & | trx | ) | const |
Precomputes digests, signatures and operation validations. "Expensive" computations may be done in a parallel thread.
trx | the transaction to preprocess |
Definition at line 926 of file db_block.cpp.
fc::future< void > graphene::chain::database::precompute_parallel | ( | const signed_block & | block, |
const uint32_t | skip = skip_nothing |
||
) | const |
Precomputes digests, signatures and operation validations depending on skip flags. "Expensive" computations may be done in a parallel thread.
block | the block to preprocess |
skip | indicates which computations can be skipped |
Definition at line 888 of file db_block.cpp.
generic_operation_result graphene::chain::database::process_tickets | ( | ) |
Definition at line 652 of file db_update.cpp.
uint32_t graphene::chain::database::push_applied_operation | ( | const operation & | op, |
bool | is_virtual = true |
||
) |
This method is used to track appied 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 is cleared after applying each block and calling the block observers which may want to index these operations.
op | The operation to push |
is_virtual | Whether the operation is a virtual operation |
Definition at line 548 of file db_block.cpp.
bool graphene::chain::database::push_block | ( | const signed_block & | new_block, |
uint32_t | skip = skip_nothing |
||
) |
Push block "may fail" in which case every partial change is unwound. After push block is successful the block is appended to the chain database on disk.
Definition at line 118 of file db_block.cpp.
processed_transaction graphene::chain::database::push_proposal | ( | const proposal_object & | proposal | ) |
fc::exception | if the proposed transaction fails to apply. |
Definition at line 336 of file db_block.cpp.
processed_transaction graphene::chain::database::push_transaction | ( | const precomputable_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 size. Although the transaction will probably not propagate further now, as the peers are likely to have their pending queues full as well, it will be kept in the queue to be propagated later when a new block flushes out the pending queues.
Definition at line 270 of file db_block.cpp.
void graphene::chain::database::reindex | ( | fc::path | data_dir | ) |
Rebuild object graph from block history and open detabase.
data_dir | the path to store the database |
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.
Definition at line 55 of file db_management.cpp.
void graphene::chain::database::revive_bitasset | ( | const asset_object & | bitasset, |
const asset_bitasset_data_object & | bad | ||
) |
Definition at line 422 of file db_market.cpp.
void graphene::chain::database::set_applied_operation_result | ( | uint32_t | op_id, |
const operation_result & | r | ||
) |
Definition at line 555 of file db_block.cpp.
string graphene::chain::database::to_pretty_string | ( | const asset & | a | ) | const |
Definition at line 49 of file db_balance.cpp.
void graphene::chain::database::update_bitasset_current_feed | ( | const asset_bitasset_data_object & | bitasset, |
bool | skip_median_update = false |
||
) |
Derive asset_bitasset_data_object::current_feed from other data in the database
bitasset | The bitasset object |
skip_median_update | Whether to skip updating asset_bitasset_data_object::median_feed |
Definition at line 270 of file db_update.cpp.
processed_transaction graphene::chain::database::validate_transaction | ( | const signed_transaction & | trx | ) |
This method validates transactions without adding it to the pending state.
Definition at line 307 of file db_block.cpp.
void graphene::chain::database::wipe | ( | const fc::path & | data_dir, |
bool | include_blocks | ||
) |
wipe Delete database from disk, and potentially the raw chain as well.
data_dir | the path to store the database |
include_blocks | If true, delete the raw chain as well as the database. |
Will close the database before wiping. Database will be closed when this function returns.
Definition at line 165 of file db_management.cpp.
uint32_t graphene::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.
Definition at line 98 of file db_witness_schedule.cpp.
uint32_t graphene::chain::database::_current_block_num = 0 |
Definition at line 800 of file database.hpp.
fc::time_point_sec graphene::chain::database::_current_block_time |
Definition at line 799 of file database.hpp.
std::deque< precomputable_transaction > graphene::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 660 of file database.hpp.
fc::signal<void(const signed_block&)> graphene::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 624 of file database.hpp.
fc::signal<void(const vector<object_id_type>&, const flat_set<account_id_type>&)> graphene::chain::database::changed_objects |
Emitted After a block has been applied and committed. The callback should not yield and should execute quickly.
Definition at line 642 of file database.hpp.
fc::signal<void(const vector<object_id_type>&, const flat_set<account_id_type>&)> graphene::chain::database::new_objects |
Emitted After a block has been applied and committed. The callback should not yield and should execute quickly.
Definition at line 636 of file database.hpp.
fc::signal<void(const signed_transaction&)> graphene::chain::database::on_pending_transaction |
This signal is emitted any time a new transaction is added to the pending block state.
Definition at line 630 of file database.hpp.
fc::signal<void(const vector<object_id_type>&, const vector<const object*>&, const flat_set<account_id_type>&)> graphene::chain::database::removed_objects |
this signal is emitted any time an object is removed and contains a pointer to the last value of every object that was removed.
Definition at line 648 of file database.hpp.