Bitshares-Core  2.0.180202
Your share in the Decentralized Exchange
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
graphene::chain::database Class Reference

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

#include <database.hpp>

Inheritance diagram for graphene::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 = 1 << 6,
  skip_merkle_check = 1 << 7, skip_assert_evaluation = 1 << 8, skip_undo_history_check = 1 << 9, skip_witness_schedule_check = 1 << 10,
  skip_validate = 1 << 11
}
 

Public Member Functions

 database ()
 
 ~database ()
 
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)
 
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_blockfetch_block_by_id (const block_id_type &id) const
 
optional< signed_blockfetch_block_by_number (uint32_t num) const
 
const signed_transactionget_recent_transaction (const transaction_id_type &trx_id) const
 
std::vector< block_id_typeget_block_ids_on_fork (block_id_type head_of_fork) const
 
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_typeget_checkpoints () const
 
bool before_last_checkpoint () const
 
bool push_block (const signed_block &b, uint32_t skip=skip_nothing)
 
processed_transaction push_transaction (const signed_transaction &trx, uint32_t skip=skip_nothing)
 
bool _push_block (const signed_block &b)
 
processed_transaction _push_transaction (const signed_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)
 
signed_block _generate_block (const fc::time_point_sec when, witness_id_type witness_id, const fc::ecc::private_key &block_signing_private_key)
 
void pop_block ()
 
void clear_pending ()
 
uint32_t push_applied_operation (const operation &op)
 
void set_applied_operation_result (uint32_t op_id, const operation_result &r)
 
const vector< optional< operation_history_object > > & get_applied_operations () const
 
string to_pretty_string (const asset &a) const
 
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
 
void update_witness_schedule ()
 
const chain_id_typeget_chain_id () const
 
const asset_objectget_core_asset () const
 
const chain_property_objectget_chain_properties () const
 
const global_property_objectget_global_properties () const
 
const dynamic_global_property_objectget_dynamic_global_properties () const
 
const node_property_objectget_node_properties () const
 
const fee_schedulecurrent_fee_schedule () 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_objectnode_properties ()
 
uint32_t last_non_undoable_block_num () const
 
void initialize_evaluators ()
 
void initialize_indexes ()
 Reset the object graph in-memory. More...
 
void init_genesis (const genesis_state_type &genesis_state=genesis_state_type())
 
template<typename EvaluatorType >
void register_evaluator ()
 
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...
 
optional< vesting_balance_id_typedeposit_lazy_vesting (const optional< vesting_balance_id_type > &ovbid, share_type amount, uint32_t req_vesting_seconds, 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)
 
void deposit_witness_pay (const witness_object &wit, share_type amount)
 
void debug_dump ()
 
void apply_debug_updates ()
 
void debug_update (const fc::variant_object &update)
 
bool fill_order (const limit_order_object &order, const asset &pays, const asset &receives, bool cull_if_small, const price &fill_price, const bool is_maker)
 
bool fill_order (const call_order_object &order, const asset &pays, const asset &receives, const price &fill_price, const bool is_maker)
 
bool fill_order (const force_settlement_object &settle, const asset &pays, const asset &receives, const price &fill_price, const bool is_maker)
 
bool check_call_orders (const asset_object &mia, bool enable_black_swan=true, bool for_new_limit_order=false)
 
void pay_order (const account_object &receiver, const asset &receives, const asset &pays)
 
asset calculate_market_fee (const asset_object &recv_asset, const asset &trade_amount)
 
asset pay_market_fees (const asset_object &recv_asset, const asset &receives)
 
processed_transaction validate_transaction (const signed_transaction &trx)
 
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)
 
void globally_settle_asset (const asset_object &bitasset, const price &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 &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...
 
template<typename OrderType >
int match (const limit_order_object &bid, const OrderType &ask, const price &match_price)
 
int match (const limit_order_object &bid, const limit_order_object &ask, const price &trade_price)
 
asset match (const call_order_object &call, const force_settlement_object &settle, const price &match_price, asset max_settlement, const price &fill_price)
 

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
 
std::deque< signed_transaction_popped_tx
 

Protected Member Functions

void pop_undo ()
 
void notify_changed_objects ()
 

Detailed Description

tracks the blockchain state in an extensible manner

Definition at line 57 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_assert_evaluation 

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

Definition at line 65 of file database.hpp.

Constructor & Destructor Documentation

◆ database()

graphene::chain::database::database ( )

Definition at line 38 of file db_management.cpp.

◆ ~database()

graphene::chain::database::~database ( )

Definition at line 44 of file db_management.cpp.

Member Function Documentation

◆ _generate_block()

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 
)

Definition at line 312 of file db_block.cpp.

◆ _push_block()

bool graphene::chain::database::_push_block ( const signed_block b)

TODO: if the block is greater than the head block and before the next maitenance interval

Definition at line 129 of file db_block.cpp.

◆ _push_transaction()

processed_transaction graphene::chain::database::_push_transaction ( const signed_transaction trx)

Definition at line 229 of file db_block.cpp.

◆ add_checkpoints()

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

Definition at line 675 of file db_block.cpp.

◆ adjust_balance()

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.

Parameters
accountID of account whose balance should be adjusted
deltaAsset ID and amount to adjust balance by

Definition at line 53 of file db_balance.cpp.

◆ apply_block()

void graphene::chain::database::apply_block ( const signed_block next_block,
uint32_t  skip = skip_nothing 
)

Definition at line 467 of file db_block.cpp.

◆ apply_debug_updates()

void graphene::chain::database::apply_debug_updates ( )

Definition at line 178 of file db_debug.cpp.

◆ apply_operation()

operation_result graphene::chain::database::apply_operation ( transaction_evaluation_state eval_state,
const operation op 
)

Definition at line 630 of file db_block.cpp.

◆ apply_order()

bool graphene::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.

Definition at line 239 of file db_market.cpp.

◆ apply_transaction()

processed_transaction graphene::chain::database::apply_transaction ( const signed_transaction trx,
uint32_t  skip = skip_nothing 
)

Definition at line 549 of file db_block.cpp.

◆ before_last_checkpoint()

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

Definition at line 681 of file db_block.cpp.

◆ calculate_market_fee()

asset graphene::chain::database::calculate_market_fee ( const asset_object recv_asset,
const asset trade_amount 
)

Definition at line 661 of file db_market.cpp.

◆ cancel_bid()

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

Definition at line 142 of file db_market.cpp.

◆ cancel_order() [1/2]

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

Definition at line 179 of file db_market.cpp.

◆ cancel_order() [2/2]

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

Definition at line 194 of file db_market.cpp.

◆ check_call_orders()

bool graphene::chain::database::check_call_orders ( const asset_object mia,
bool  enable_black_swan = true,
bool  for_new_limit_order = 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

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.
for_new_limit_order- true if this function is called when matching call orders with a new limit order
Returns
true if a margin call was executed.

Definition at line 522 of file db_market.cpp.

◆ clear_pending()

void graphene::chain::database::clear_pending ( )

Definition at line 432 of file db_block.cpp.

◆ close()

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

Definition at line 178 of file db_management.cpp.

◆ current_fee_schedule()

const fee_schedule & graphene::chain::database::current_fee_schedule ( ) const

Definition at line 55 of file db_getter.cpp.

◆ debug_dump()

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 39 of file db_debug.cpp.

◆ debug_update()

void graphene::chain::database::debug_update ( const fc::variant_object &  update)

Definition at line 188 of file db_debug.cpp.

◆ deposit_cashback()

void graphene::chain::database::deposit_cashback ( const account_object acct,
share_type  amount,
bool  require_vesting = true 
)

Definition at line 129 of file db_balance.cpp.

◆ deposit_lazy_vesting()

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,
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.

Returns
ID of newly created VBO, but only if VBO was created.

Definition at line 81 of file db_balance.cpp.

◆ deposit_witness_pay()

void graphene::chain::database::deposit_witness_pay ( const witness_object wit,
share_type  amount 
)

Definition at line 166 of file db_balance.cpp.

◆ execute_bid()

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 157 of file db_market.cpp.

◆ fetch_block_by_id()

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

Definition at line 64 of file db_block.cpp.

◆ fetch_block_by_number()

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

Definition at line 72 of file db_block.cpp.

◆ fill_order() [1/3]

bool graphene::chain::database::fill_order ( const limit_order_object order,
const asset pays,
const asset receives,
bool  cull_if_small,
const price fill_price,
const bool  is_maker 
)
Returns
true if the order was completely filled and thus freed.

Definition at line 383 of file db_market.cpp.

◆ fill_order() [2/3]

bool graphene::chain::database::fill_order ( const call_order_object order,
const asset pays,
const asset receives,
const price fill_price,
const bool  is_maker 
)

Definition at line 427 of file db_market.cpp.

◆ fill_order() [3/3]

bool graphene::chain::database::fill_order ( const force_settlement_object settle,
const asset pays,
const asset receives,
const price fill_price,
const bool  is_maker 
)

Definition at line 482 of file db_market.cpp.

◆ generate_block()

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 297 of file db_block.cpp.

◆ get_applied_operations()

const vector< optional< operation_history_object > > & graphene::chain::database::get_applied_operations ( ) const

Definition at line 460 of file db_block.cpp.

◆ get_balance() [1/2]

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.

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

Definition at line 34 of file db_balance.cpp.

◆ get_balance() [2/2]

asset graphene::chain::database::get_balance ( const account_object owner,
const asset_object asset_obj 
) const

This is an overloaded method.

Definition at line 43 of file db_balance.cpp.

◆ get_block_id_for_num()

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

Definition at line 59 of file db_block.cpp.

◆ get_block_ids_on_fork()

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

Definition at line 90 of file db_block.cpp.

◆ get_chain_id()

const chain_id_type & graphene::chain::database::get_chain_id ( ) const

Definition at line 80 of file db_getter.cpp.

◆ get_chain_properties()

const chain_property_object & graphene::chain::database::get_chain_properties ( ) const

Definition at line 45 of file db_getter.cpp.

◆ get_checkpoints()

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

Definition at line 137 of file database.hpp.

◆ get_core_asset()

const asset_object & graphene::chain::database::get_core_asset ( ) const

Definition at line 35 of file db_getter.cpp.

◆ get_dynamic_global_properties()

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

Definition at line 50 of file db_getter.cpp.

◆ get_global_properties()

const global_property_object & graphene::chain::database::get_global_properties ( ) const

Definition at line 40 of file db_getter.cpp.

◆ get_node_properties()

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

Definition at line 85 of file db_getter.cpp.

◆ get_recent_transaction()

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

Definition at line 82 of file db_block.cpp.

◆ get_scheduled_witness()

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 34 of file db_witness_schedule.cpp.

◆ get_slot_at_time()

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 72 of file db_witness_schedule.cpp.

◆ get_slot_time()

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 42 of file db_witness_schedule.cpp.

◆ globally_settle_asset()

void graphene::chain::database::globally_settle_asset ( const asset_object mia,
const price settlement_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 Force settlement happens without delay at the swan price, deducting from force-settlement fund No more asset updates may be issued.

After all margin positions are closed, the current supply will be reported as 0, but that is a lie, the supply didn't change. We need to capture the current supply before filling all call orders and then restore it afterward. Then in the force settlement evaluator reduce the supply

Definition at line 43 of file db_market.cpp.

◆ head_block_id()

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

Definition at line 70 of file db_getter.cpp.

◆ head_block_num()

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

Definition at line 65 of file db_getter.cpp.

◆ head_block_time()

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

Definition at line 60 of file db_getter.cpp.

◆ head_block_witness()

witness_id_type graphene::chain::database::head_block_witness ( ) const

◆ init_genesis()

void graphene::chain::database::init_genesis ( const genesis_state_type genesis_state = genesis_state_type())

Definition at line 223 of file db_init.cpp.

◆ initialize_evaluators()

void graphene::chain::database::initialize_evaluators ( )

Definition at line 130 of file db_init.cpp.

◆ initialize_indexes()

void graphene::chain::database::initialize_indexes ( )

Reset the object graph in-memory.

Definition at line 177 of file db_init.cpp.

◆ is_known_block()

bool graphene::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

Definition at line 44 of file db_block.cpp.

◆ is_known_transaction()

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 53 of file db_block.cpp.

◆ last_non_undoable_block_num()

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

Definition at line 95 of file db_getter.cpp.

◆ match() [1/3]

template<typename OrderType >
int graphene::chain::database::match ( const limit_order_object usd,
const OrderType &  core,
const price match_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

Definition at line 301 of file db_market.cpp.

◆ match() [2/3]

int graphene::chain::database::match ( const limit_order_object bid,
const limit_order_object ask,
const price trade_price 
)

Definition at line 343 of file db_market.cpp.

◆ match() [3/3]

asset graphene::chain::database::match ( const call_order_object call,
const force_settlement_object settle,
const price match_price,
asset  max_settlement,
const price fill_price 
)
Returns
the amount of asset settled

If the least collateralized call position lacks sufficient collateral to cover at the match price then this indicates a black swan event according to the price feed, but only the market can trigger a black swan. So now we must cancel the forced settlement object.

Definition at line 349 of file db_market.cpp.

◆ node_properties()

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

Definition at line 90 of file db_getter.cpp.

◆ notify_changed_objects()

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

Definition at line 356 of file db_notify.cpp.

◆ open()

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.

Parameters
data_dirPath to open or create database in
genesis_loaderA callable object which returns the genesis state to initialize new databases on
db_versiona version string that changes when the internal database format and/or logic is modified

Definition at line 134 of file db_management.cpp.

◆ pay_market_fees()

asset graphene::chain::database::pay_market_fees ( const asset_object recv_asset,
const asset receives 
)

Definition at line 681 of file db_market.cpp.

◆ pay_order()

void graphene::chain::database::pay_order ( const account_object receiver,
const asset receives,
const asset pays 
)

Definition at line 649 of file db_market.cpp.

◆ pop_block()

void graphene::chain::database::pop_block ( )

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

Definition at line 418 of file db_block.cpp.

◆ pop_undo()

void graphene::chain::database::pop_undo ( )
inlineprotected

Definition at line 414 of file database.hpp.

◆ push_applied_operation()

uint32_t graphene::chain::database::push_applied_operation ( const operation op)

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.

Returns
the op_id which can be used to set the result after it has finished being applied.

Definition at line 439 of file db_block.cpp.

◆ push_block()

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.

Returns
true if we switched forks as a result of this push.

Definition at line 114 of file db_block.cpp.

◆ push_proposal()

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

Definition at line 260 of file db_block.cpp.

◆ push_transaction()

processed_transaction graphene::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 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 219 of file db_block.cpp.

◆ register_evaluator()

template<typename EvaluatorType >
void graphene::chain::database::register_evaluator ( )
inline

Definition at line 280 of file database.hpp.

◆ reindex()

void graphene::chain::database::reindex ( fc::path  data_dir)

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.

Definition at line 49 of file db_management.cpp.

◆ revive_bitasset()

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

Definition at line 95 of file db_market.cpp.

◆ set_applied_operation_result()

void graphene::chain::database::set_applied_operation_result ( uint32_t  op_id,
const operation_result r 
)

Definition at line 449 of file db_block.cpp.

◆ to_pretty_string()

string graphene::chain::database::to_pretty_string ( const asset a) const

Definition at line 48 of file db_balance.cpp.

◆ update_witness_schedule()

void graphene::chain::database::update_witness_schedule ( )

High performance random generator http://xorshift.di.unimi.it/

Definition at line 86 of file db_witness_schedule.cpp.

◆ validate_transaction()

processed_transaction graphene::chain::database::validate_transaction ( const signed_transaction trx)

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

Returns
true if the transaction would validate

Definition at line 254 of file db_block.cpp.

◆ wipe()

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.

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.

Definition at line 125 of file db_management.cpp.

◆ witness_participation_rate()

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 80 of file db_witness_schedule.cpp.

Member Data Documentation

◆ _popped_tx

std::deque< signed_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 407 of file database.hpp.

◆ applied_block

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 186 of file database.hpp.

◆ changed_objects

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 204 of file database.hpp.

◆ new_objects

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 198 of file database.hpp.

◆ on_pending_transaction

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 192 of file database.hpp.

◆ removed_objects

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 209 of file database.hpp.


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