Electroneum
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
cryptonote::Blockchain Class Reference

#include <blockchain.h>

Collaboration diagram for cryptonote::Blockchain:
Collaboration graph
[legend]

Classes

struct  block_extended_info
 container for passing a block and metadata about it on the blockchain More...
 
struct  transaction_chain_entry
 Now-defunct (TODO: remove) struct from in-memory blockchain. More...
 

Public Member Functions

 Blockchain (tx_memory_pool &tx_pool)
 Blockchain constructor. More...
 
 ~Blockchain ()
 Blockchain destructor. More...
 
bool init (BlockchainDB *db, const network_type nettype=MAINNET, bool offline=false, const cryptonote::test_options *test_options=NULL, difficulty_type fixed_difficulty=0, const GetCheckpointsCallback &get_checkpoints=nullptr, bool ignore_bsig=false, bool fallback_to_pow=false)
 Initialize the Blockchain state. More...
 
bool init (BlockchainDB *db, HardFork *&hf, const network_type nettype=MAINNET, bool offline=false)
 Initialize the Blockchain state. More...
 
bool deinit ()
 Uninitializes the blockchain state. More...
 
void set_checkpoints (checkpoints &&chk_pts)
 assign a set of blockchain checkpoint hashes More...
 
bool get_blocks (uint64_t start_offset, size_t count, std::vector< std::pair< cryptonote::blobdata, block >> &blocks, std::vector< cryptonote::blobdata > &txs) const
 get blocks and transactions from blocks based on start height and count More...
 
bool get_blocks (uint64_t start_offset, size_t count, std::vector< std::pair< cryptonote::blobdata, block >> &blocks) const
 get blocks from blocks based on start height and count More...
 
bool get_alternative_blocks (std::vector< block > &blocks) const
 compiles a list of all blocks stored as alternative chains More...
 
size_t get_alternative_blocks_count () const
 returns the number of alternative blocks stored More...
 
crypto::hash get_block_id_by_height (uint64_t height) const
 gets a block's hash given a height More...
 
bool get_block_by_hash (const crypto::hash &h, block &blk, bool *orphan=NULL) const
 gets the block with a given hash More...
 
bool prepare_handle_incoming_blocks (const std::vector< block_complete_entry > &blocks_entry, std::vector< block > &blocks)
 performs some preprocessing on a group of incoming blocks to speed up verification More...
 
bool cleanup_handle_incoming_blocks (bool force_sync=false)
 incoming blocks post-processing, cleanup, and disk sync More...
 
bool have_tx (const crypto::hash &id) const
 search the blockchain for a transaction by hash More...
 
bool have_tx_keyimges_as_spent (const transaction &tx) const
 check if any key image in a transaction has already been spent More...
 
bool have_tx_keyimg_as_spent (const crypto::key_image &key_im) const
 check if a key image is already spent on the blockchain More...
 
uint64_t get_current_blockchain_height () const
 get the current height of the blockchain More...
 
crypto::hash get_tail_id () const
 get the hash of the most recent block on the blockchain More...
 
crypto::hash get_tail_id (uint64_t &height) const
 get the height and hash of the most recent block on the blockchain More...
 
difficulty_type get_difficulty_for_next_block ()
 returns the difficulty target the next block to be added must meet More...
 
void normalize_v7_difficulties ()
 Normalize the cumulative difficulty for V7 blocks, fixing the differing difficulty among nodes. More...
 
bool add_new_block (const block &bl_, block_verification_context &bvc)
 adds a block to the blockchain More...
 
bool reset_and_set_genesis_block (const block &b)
 clears the blockchain and starts a new one More...
 
bool create_block_template (block &b, const account_public_address &miner_address, difficulty_type &di, uint64_t &height, uint64_t &expected_reward, const blobdata &ex_nonce)
 creates a new block to mine against More...
 
bool create_block_template (block &b, const crypto::hash *from_block, const account_public_address &miner_address, difficulty_type &di, uint64_t &height, uint64_t &expected_reward, const blobdata &ex_nonce)
 
bool have_block (const crypto::hash &id) const
 checks if a block is known about with a given hash More...
 
size_t get_total_transactions () const
 gets the total number of transactions on the main chain More...
 
bool get_short_chain_history (std::list< crypto::hash > &ids) const
 gets the hashes for a subset of the blockchain More...
 
bool find_blockchain_supplement (const std::list< crypto::hash > &qblock_ids, std::vector< crypto::hash > &hashes, uint64_t &start_height, uint64_t &current_height, bool clip_pruned) const
 get recent block hashes for a foreign chain More...
 
bool find_blockchain_supplement (const std::list< crypto::hash > &qblock_ids, NOTIFY_RESPONSE_CHAIN_ENTRY::request &resp) const
 get recent block hashes for a foreign chain More...
 
bool find_blockchain_supplement (const std::list< crypto::hash > &qblock_ids, uint64_t &starter_offset) const
 find the most recent common point between ours and a foreign chain More...
 
bool find_blockchain_supplement (const uint64_t req_start_block, const std::list< crypto::hash > &qblock_ids, std::vector< std::pair< std::pair< cryptonote::blobdata, crypto::hash >, std::vector< std::pair< crypto::hash, cryptonote::blobdata > > > > &blocks, uint64_t &total_height, uint64_t &start_height, bool pruned, bool get_miner_tx_hash, size_t max_count) const
 get recent blocks for a foreign chain More...
 
bool handle_get_objects (NOTIFY_REQUEST_GET_OBJECTS::request &arg, NOTIFY_RESPONSE_GET_OBJECTS::request &rsp)
 retrieves a set of blocks and their transactions, and possibly other transactions More...
 
uint64_t get_num_mature_outputs (uint64_t amount) const
 get number of outputs of an amount past the minimum spendable age More...
 
crypto::public_key get_output_key (uint64_t amount, uint64_t global_index) const
 get the public key for an output More...
 
bool get_outs (const COMMAND_RPC_GET_OUTPUTS_BIN::request &req, COMMAND_RPC_GET_OUTPUTS_BIN::response &res) const
 gets specific outputs to mix with More...
 
void get_output_key_mask_unlocked (const uint64_t &amount, const uint64_t &index, crypto::public_key &key, rct::key &mask, bool &unlocked) const
 gets an output's key and unlocked state More...
 
bool get_output_distribution (uint64_t amount, uint64_t from_height, uint64_t to_height, uint64_t &start_height, std::vector< uint64_t > &distribution, uint64_t &base) const
 gets per block distribution of outputs of a given amount More...
 
bool get_tx_outputs_gindexs (const crypto::hash &tx_id, std::vector< uint64_t > &indexs) const
 gets the global indices for outputs from a given transaction More...
 
bool get_tx_outputs_gindexs (const crypto::hash &tx_id, size_t n_txes, std::vector< std::vector< uint64_t >> &indexs) const
 
bool store_blockchain ()
 stores the blockchain More...
 
bool check_tx_inputs (transaction &tx, uint64_t &pmax_used_block_height, crypto::hash &max_used_block_id, tx_verification_context &tvc, bool kept_by_block=false)
 validates a transaction's inputs More...
 
uint64_t get_dynamic_base_fee_estimate (uint64_t grace_blocks) const
 get dynamic per kB or byte fee estimate for the next few blocks More...
 
bool check_fee (size_t tx_weight, uint64_t fee) const
 validate a transaction's fee More...
 
bool check_tx_outputs (const transaction &tx, tx_verification_context &tvc)
 check that a transaction's outputs conform to current standards More...
 
uint64_t get_current_cumulative_block_weight_limit () const
 gets the block weight limit based on recent blocks More...
 
uint64_t get_next_long_term_block_weight (uint64_t block_weight) const
 gets the long term block weight for a new block More...
 
uint64_t get_current_cumulative_block_weight_median () const
 gets the block weight median based on recent blocks (same window as for the limit) More...
 
difficulty_type block_difficulty (uint64_t i) const
 gets the difficulty of the block with a given height More...
 
template<class t_ids_container , class t_blocks_container , class t_missed_container >
bool get_blocks (const t_ids_container &block_ids, t_blocks_container &blocks, t_missed_container &missed_bs) const
 gets blocks based on a list of block hashes More...
 
template<class t_ids_container , class t_tx_container , class t_missed_container >
bool get_transactions_blobs (const t_ids_container &txs_ids, t_tx_container &txs, t_missed_container &missed_txs, bool pruned=false) const
 gets transactions based on a list of transaction hashes More...
 
template<class t_ids_container , class t_tx_container , class t_missed_container >
bool get_split_transactions_blobs (const t_ids_container &txs_ids, t_tx_container &txs, t_missed_container &missed_txs) const
 
template<class t_ids_container , class t_tx_container , class t_missed_container >
bool get_transactions (const t_ids_container &txs_ids, t_tx_container &txs, t_missed_container &missed_txs) const
 
void check_against_checkpoints (const checkpoints &points, bool enforce)
 check the blockchain against a set of checkpoints More...
 
void set_enforce_dns_checkpoints (bool enforce)
 configure whether or not to enforce DNS-based checkpoints More...
 
bool update_checkpoints (const std::string &file_path, bool check_dns)
 loads new checkpoints from a file and optionally from DNS More...
 
void set_user_options (uint64_t maxthreads, bool sync_on_blocks, uint64_t sync_threshold, blockchain_db_sync_mode sync_mode, bool fast_sync, std::string validator_key)
 Update the validators public key by fetching data from electroneum's endpoint. More...
 
void set_block_notify (const std::shared_ptr< tools::Notify > &notify)
 sets a block notify object to call for every new block More...
 
void set_reorg_notify (const std::shared_ptr< tools::Notify > &notify)
 sets a reorg notify object to call for every reorg More...
 
void safesyncmode (const bool onoff)
 Put DB in safe sync mode. More...
 
void set_show_time_stats (bool stats)
 set whether or not to show/print time statistics More...
 
HardFork::State get_hard_fork_state () const
 gets the hardfork voting state object More...
 
uint8_t get_current_hard_fork_version () const
 gets the current hardfork version in use/voted for More...
 
uint8_t get_ideal_hard_fork_version () const
 returns the newest hardfork version known to the blockchain More...
 
uint8_t get_next_hard_fork_version () const
 returns the next hardfork version More...
 
uint8_t get_ideal_hard_fork_version (uint64_t height) const
 returns the newest hardfork version voted to be enabled as of a certain height More...
 
uint8_t get_hard_fork_version (uint64_t height) const
 returns the actual hardfork version for a given block height More...
 
uint64_t get_earliest_ideal_height_for_version (uint8_t version) const
 returns the earliest block a given version may activate More...
 
bool get_hard_fork_voting_info (uint8_t version, uint32_t &window, uint32_t &votes, uint32_t &threshold, uint64_t &earliest_height, uint8_t &voting) const
 get information about hardfork voting for a version More...
 
uint64_t get_difficulty_target () const
 get difficulty target based on chain and hardfork version More...
 
bool flush_txes_from_pool (const std::vector< crypto::hash > &txids)
 remove transactions from the transaction pool (if present) More...
 
std::map< uint64_t, std::tuple< uint64_t, uint64_t, uint64_t > > get_output_histogram (const std::vector< uint64_t > &amounts, bool unlocked, uint64_t recent_cutoff, uint64_t min_count=0) const
 return a histogram of outputs on the blockchain More...
 
bool for_all_key_images (std::function< bool(const crypto::key_image &)>) const
 perform a check on all key images in the blockchain More...
 
bool for_blocks_range (const uint64_t &h1, const uint64_t &h2, std::function< bool(uint64_t, const crypto::hash &, const block &)>) const
 perform a check on all blocks in the blockchain in the given range More...
 
bool for_all_transactions (std::function< bool(const crypto::hash &, const cryptonote::transaction &)>, bool pruned) const
 perform a check on all transactions in the blockchain More...
 
bool for_all_outputs (std::function< bool(uint64_t amount, const crypto::hash &tx_hash, uint64_t height, size_t tx_idx)>) const
 perform a check on all outputs in the blockchain More...
 
bool for_all_outputs (uint64_t amount, std::function< bool(uint64_t height)>) const
 perform a check on all outputs of a given amount in the blockchain More...
 
const BlockchainDBget_db () const
 get a reference to the BlockchainDB in use by Blockchain More...
 
BlockchainDBget_db ()
 get a reference to the BlockchainDB in use by Blockchain More...
 
void output_scan_worker (const uint64_t amount, const std::vector< uint64_t > &offsets, std::vector< output_data_t > &outputs) const
 get a number of outputs of a specific amount More...
 
void block_longhash_worker (uint64_t height, const epee::span< const block > &blocks, std::unordered_map< crypto::hash, crypto::hash > &map) const
 computes the "short" and "long" hashes for a set of blocks More...
 
std::list< std::pair< block_extended_info, std::vector< crypto::hash > > > get_alternative_chains () const
 returns a set of known alternate chains More...
 
void add_txpool_tx (const crypto::hash &txid, const cryptonote::blobdata &blob, const txpool_tx_meta_t &meta)
 
void update_txpool_tx (const crypto::hash &txid, const txpool_tx_meta_t &meta)
 
void remove_txpool_tx (const crypto::hash &txid)
 
uint64_t get_txpool_tx_count (bool include_unrelayed_txes=true) const
 
bool get_txpool_tx_meta (const crypto::hash &txid, txpool_tx_meta_t &meta) const
 
bool get_txpool_tx_blob (const crypto::hash &txid, cryptonote::blobdata &bd) const
 
cryptonote::blobdata get_txpool_tx_blob (const crypto::hash &txid) const
 
bool for_all_txpool_txes (std::function< bool(const crypto::hash &, const txpool_tx_meta_t &, const cryptonote::blobdata *)>, bool include_blob=false, bool include_unrelayed_txes=true) const
 
uint32_t get_mempool_tx_livetime () const
 
bool is_within_compiled_block_hash_area (uint64_t height) const
 
bool is_within_compiled_block_hash_area () const
 
uint32_t get_blockchain_pruning_seed () const
 
bool prune_blockchain (uint32_t pruning_seed=0)
 
bool update_blockchain_pruning ()
 
bool check_blockchain_pruning ()
 
void lock ()
 
void unlock ()
 
void cancel ()
 
void on_new_tx_from_block (const cryptonote::transaction &tx)
 called when we see a tx originating from a block More...
 
std::vector< time_t > get_last_block_timestamps (unsigned int blocks) const
 returns the timestamps of the last N blocks More...
 
void pop_blocks (uint64_t nblocks)
 removes blocks from the top of the blockchain More...
 
void set_validator_key (std::string key)
 set validator key More...
 
void set_validators_list_instance (std::unique_ptr< electroneum::basic::Validators > &v)
 
electroneum::basic::Validator get_validator_by_height (uint64_t height)
 
network_type get_nettype () const
 get blockchain nettype More...
 

Static Public Member Functions

static uint64_t get_fee_quantization_mask ()
 get fee quantization mask More...
 
static uint64_t get_dynamic_base_fee (uint64_t block_reward, size_t median_block_weight, uint8_t version)
 get dynamic per kB or byte fee for a given block weight More...
 
static const std::vector< HardFork::Params > & get_hard_fork_heights (network_type nettype)
 gets the hardfork heights of given network More...
 

Private Types

typedef std::unordered_map< crypto::hash, size_t > blocks_by_id_index
 
typedef std::unordered_map< crypto::hash, transaction_chain_entrytransactions_container
 
typedef std::unordered_set< crypto::key_imagekey_images_container
 
typedef std::vector< block_extended_infoblocks_container
 
typedef std::unordered_map< crypto::hash, block_extended_infoblocks_ext_by_hash
 
typedef std::unordered_map< crypto::hash, blockblocks_by_hash
 
typedef std::map< uint64_t, std::vector< std::pair< crypto::hash, size_t > > > outputs_container
 

Private Member Functions

template<class visitor_t >
bool scan_outputkeys_for_indexes (size_t tx_version, const txin_to_key &tx_in_to_key, visitor_t &vis, const crypto::hash &tx_prefix_hash, uint64_t *pmax_related_block_height=NULL) const
 collects the keys for all outputs being "spent" as an input More...
 
bool check_tx_input (size_t tx_version, const txin_to_key &txin, const crypto::hash &tx_prefix_hash, const std::vector< crypto::signature > &sig, const rct::rctSig &rct_signatures, std::vector< rct::ctkey > &output_keys, uint64_t *pmax_related_block_height)
 collect output public keys of a transaction input set More...
 
bool check_tx_inputs (transaction &tx, tx_verification_context &tvc, uint64_t *pmax_used_block_height=NULL)
 validate a transaction's inputs and their keys More...
 
bool switch_to_alternative_blockchain (std::list< blocks_ext_by_hash::const_iterator > &alt_chain, bool discard_disconnected_chain)
 performs a blockchain reorganization according to the longest chain rule More...
 
block pop_block_from_blockchain ()
 removes the most recent block from the blockchain More...
 
bool handle_block_to_main_chain (const block &bl, block_verification_context &bvc)
 validate and add a new block to the end of the blockchain More...
 
bool handle_block_to_main_chain (const block &bl, const crypto::hash &id, block_verification_context &bvc)
 validate and add a new block to the end of the blockchain More...
 
bool handle_alternative_block (const block &b, const crypto::hash &id, block_verification_context &bvc)
 validate and add a new block to an alternate blockchain More...
 
bool build_alt_chain (const crypto::hash &prev_id, std::list< blocks_ext_by_hash::const_iterator > &alt_chain, std::vector< uint64_t > &timestamps, block_verification_context &bvc) const
 builds a list of blocks connecting a block to the main chain More...
 
difficulty_type get_next_difficulty_for_alternative_chain (const std::list< blocks_ext_by_hash::const_iterator > &alt_chain, block_extended_info &bei) const
 gets the difficulty requirement for a new block on an alternate chain More...
 
bool prevalidate_miner_transaction (const block &b, uint64_t height)
 sanity checks a miner transaction before validating an entire block More...
 
bool validate_miner_transaction (const block &b, size_t cumulative_block_weight, uint64_t fee, uint64_t &base_reward, uint64_t already_generated_coins, bool &partial_block_reward, uint8_t version)
 validates a miner (coinbase) transaction More...
 
bool rollback_blockchain_switching (std::list< block > &original_chain, uint64_t rollback_height)
 reverts the blockchain to its previous state following a failed switch More...
 
void get_last_n_blocks_weights (std::vector< uint64_t > &weights, size_t count) const
 gets recent block weights for median calculation More...
 
uint64_t get_long_term_block_weight_median (uint64_t start_height, size_t count) const
 gets block long term weight median More...
 
bool is_tx_spendtime_unlocked (uint64_t unlock_time) const
 checks if a transaction is unlocked (its outputs spendable) More...
 
bool add_block_as_invalid (const block &bl, const crypto::hash &h)
 stores an invalid block in a separate container More...
 
bool add_block_as_invalid (const block_extended_info &bei, const crypto::hash &h)
 stores an invalid block in a separate container More...
 
bool check_block_timestamp (const block &b, uint64_t &median_ts) const
 checks a block's timestamp More...
 
bool check_block_timestamp (const block &b) const
 
bool check_block_timestamp (std::vector< uint64_t > &timestamps, const block &b, uint64_t &median_ts) const
 checks a block's timestamp More...
 
bool check_block_timestamp (std::vector< uint64_t > &timestamps, const block &b) const
 
uint64_t get_adjusted_time () const
 get the "adjusted time" More...
 
bool complete_timestamps_vector (uint64_t start_height, std::vector< uint64_t > &timestamps) const
 finish an alternate chain's timestamp window from the main chain More...
 
bool update_next_cumulative_weight_limit (uint64_t *long_term_effective_median_block_weight=NULL)
 calculate the block weight limit for the next block to be added More...
 
void return_tx_to_pool (std::vector< std::pair< transaction, blobdata >> &txs)
 
bool check_for_double_spend (const transaction &tx, key_images_container &keys_this_block) const
 make sure a transaction isn't attempting a double-spend More...
 
void check_ring_signature (const crypto::hash &tx_prefix_hash, const crypto::key_image &key_image, const std::vector< rct::ctkey > &pubkeys, const std::vector< crypto::signature > &sig, uint64_t &result)
 validates a transaction input's ring signature More...
 
void load_compiled_in_block_hashes (const GetCheckpointsCallback &get_checkpoints)
 loads block hashes from compiled-in data set More...
 
bool expand_transaction_2 (transaction &tx, const crypto::hash &tx_prefix_hash, const std::vector< std::vector< rct::ctkey >> &pubkeys)
 expands v2 transaction data from blockchain More...
 
void invalidate_block_template_cache ()
 invalidates any cached block template More...
 
void cache_block_template (const block &b, const cryptonote::account_public_address &address, const blobdata &nonce, const difficulty_type &diff, uint64_t height, uint64_t expected_reward, uint64_t pool_cookie)
 stores a new cached block template More...
 
void sign_block (block &b, std::string privateKey)
 Digitally sign the block. More...
 
bool verify_block_signature (const block &b)
 Verify block's digital signature. More...
 

Private Attributes

BlockchainDBm_db
 
tx_memory_poolm_tx_pool
 
epee::critical_section m_blockchain_lock
 
transactions_container m_transactions
 
size_t m_current_block_cumul_weight_limit
 
size_t m_current_block_cumul_weight_median
 
std::unordered_map< crypto::hash, std::unordered_map< crypto::key_image, std::vector< output_data_t > > > m_scan_table
 
std::unordered_map< crypto::hash, crypto::hashm_blocks_longhash_table
 
std::unordered_map< crypto::hash, std::unordered_map< crypto::key_image, bool > > m_check_txin_table
 
std::vector< crypto::hashm_blocks_hash_check
 
std::vector< crypto::hashm_blocks_txs_check
 
blockchain_db_sync_mode m_db_sync_mode
 
bool m_fast_sync
 
bool m_show_time_stats
 
bool m_db_default_sync
 
bool m_db_sync_on_blocks
 
uint64_t m_db_sync_threshold
 
uint64_t m_max_prepare_blocks_threads
 
uint64_t m_fake_pow_calc_time
 
uint64_t m_fake_scan_time
 
uint64_t m_sync_counter
 
uint64_t m_bytes_to_sync
 
std::vector< uint64_t > m_timestamps
 
std::vector< difficulty_typem_difficulties
 
uint64_t m_timestamps_and_difficulties_height
 
uint64_t m_long_term_block_weights_window
 
uint64_t m_long_term_effective_median_block_weight
 
crypto::hash m_long_term_block_weights_cache_tip_hash
 
epee::misc_utils::rolling_median_t< uint64_t > m_long_term_block_weights_cache_rolling_median
 
epee::critical_section m_difficulty_lock
 
crypto::hash m_difficulty_for_next_block_top_hash
 
difficulty_type m_difficulty_for_next_block
 
std::string m_validator_key
 
std::vector< std::string > m_validators_public_keys
 
boost::asio::io_service m_async_service
 
boost::thread_group m_async_pool
 
std::unique_ptr< boost::asio::io_service::work > m_async_work_idle
 
blocks_ext_by_hash m_alternative_chains
 
blocks_ext_by_hash m_invalid_blocks
 
checkpoints m_checkpoints
 
bool m_enforce_dns_checkpoints
 
HardForkm_hardfork
 
network_type m_nettype
 
bool m_offline
 
difficulty_type m_fixed_difficulty
 
bool m_ignore_bsig
 
bool m_fallback_to_pow
 
std::atomic< boolm_cancel
 
block m_btc
 
account_public_address m_btc_address
 
blobdata m_btc_nonce
 
difficulty_type m_btc_difficulty
 
uint64_t m_btc_height
 
uint64_t m_btc_pool_cookie
 
uint64_t m_btc_expected_reward
 
bool m_btc_valid
 
bool m_batch_success
 
std::shared_ptr< tools::Notifym_block_notify
 
std::shared_ptr< tools::Notifym_reorg_notify
 
electroneum::basic::Validatorsm_validators
 

Member Typedef Documentation

◆ blocks_by_hash

typedef std::unordered_map<crypto::hash, block> cryptonote::Blockchain::blocks_by_hash
private

◆ blocks_by_id_index

typedef std::unordered_map<crypto::hash, size_t> cryptonote::Blockchain::blocks_by_id_index
private

◆ blocks_container

◆ blocks_ext_by_hash

◆ key_images_container

◆ outputs_container

typedef std::map<uint64_t, std::vector<std::pair<crypto::hash, size_t> > > cryptonote::Blockchain::outputs_container
private

◆ transactions_container

Constructor & Destructor Documentation

◆ Blockchain()

Blockchain::Blockchain ( tx_memory_pool tx_pool)

Blockchain constructor.

Parameters
tx_poola reference to the transaction pool to be kept by the Blockchain

◆ ~Blockchain()

Blockchain::~Blockchain ( )

Blockchain destructor.

Member Function Documentation

◆ add_block_as_invalid() [1/2]

bool Blockchain::add_block_as_invalid ( const block bl,
const crypto::hash h 
)
private

stores an invalid block in a separate container

Storing invalid blocks allows quick dismissal of the same block if it is seen again.

Parameters
blthe invalid block
hthe block's hash
Returns
false if the block cannot be stored for some reason, otherwise true

◆ add_block_as_invalid() [2/2]

bool Blockchain::add_block_as_invalid ( const block_extended_info bei,
const crypto::hash h 
)
private

stores an invalid block in a separate container

Storing invalid blocks allows quick dismissal of the same block if it is seen again.

Parameters
beithe invalid block (see ::block_extended_info)
hthe block's hash
Returns
false if the block cannot be stored for some reason, otherwise true

◆ add_new_block()

bool Blockchain::add_new_block ( const block bl_,
block_verification_context bvc 
)

adds a block to the blockchain

Adds a new block to the blockchain. If the block's parent is not the current top of the blockchain, the block may be added to an alternate chain. If the block does not belong, is already in the blockchain or an alternate chain, or is invalid, return false.

Parameters
bl_the block to be added
bvcmetadata about the block addition's success/failure
Returns
true on successful addition to the blockchain, else false

◆ add_txpool_tx()

void Blockchain::add_txpool_tx ( const crypto::hash txid,
const cryptonote::blobdata blob,
const txpool_tx_meta_t meta 
)

◆ block_difficulty()

difficulty_type Blockchain::block_difficulty ( uint64_t  i) const

gets the difficulty of the block with a given height

Parameters
ithe height
Returns
the difficulty

◆ block_longhash_worker()

void Blockchain::block_longhash_worker ( uint64_t  height,
const epee::span< const block > &  blocks,
std::unordered_map< crypto::hash, crypto::hash > &  map 
) const

computes the "short" and "long" hashes for a set of blocks

Parameters
heightthe height of the first block
blocksthe blocks to be hashed
mapreturn-by-reference the hashes for each block

◆ build_alt_chain()

bool Blockchain::build_alt_chain ( const crypto::hash prev_id,
std::list< blocks_ext_by_hash::const_iterator > &  alt_chain,
std::vector< uint64_t > &  timestamps,
block_verification_context bvc 
) const
private

builds a list of blocks connecting a block to the main chain

Parameters
prev_idthe block hash of the tip of the alt chain
alt_chainthe chain to be added to
timestampsreturns the timestamps of previous blocks
bvcthe block verification context for error return
Returns
true on success, false otherwise

◆ cache_block_template()

void Blockchain::cache_block_template ( const block b,
const cryptonote::account_public_address address,
const blobdata nonce,
const difficulty_type diff,
uint64_t  height,
uint64_t  expected_reward,
uint64_t  pool_cookie 
)
private

stores a new cached block template

At some point, may be used to push an update to miners

◆ cancel()

void Blockchain::cancel ( )

◆ check_against_checkpoints()

void Blockchain::check_against_checkpoints ( const checkpoints points,
bool  enforce 
)

check the blockchain against a set of checkpoints

If a block fails a checkpoint and enforce is enabled, the blockchain will be rolled back to two blocks prior to that block. If enforce is disabled, as is currently the default case with DNS-based checkpoints, an error will be printed to the user but no other action will be taken.

Parameters
pointsthe checkpoints to check against
enforcewhether or not to take action on failure

◆ check_block_timestamp() [1/4]

bool cryptonote::Blockchain::check_block_timestamp ( const block b) const
inlineprivate

◆ check_block_timestamp() [2/4]

bool Blockchain::check_block_timestamp ( const block b,
uint64_t &  median_ts 
) const
private

checks a block's timestamp

This function grabs the timestamps from the most recent <n> blocks, where n = BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW. If there are not those many blocks in the blockchain, the timestap is assumed to be valid. If there are, this function returns: true if the block's timestamp is not less than the timestamp of the median of the selected blocks false otherwise

Parameters
bthe block to be checked
median_tsreturn-by-reference the median of timestamps
Returns
true if the block's timestamp is valid, otherwise false

◆ check_block_timestamp() [3/4]

bool cryptonote::Blockchain::check_block_timestamp ( std::vector< uint64_t > &  timestamps,
const block b 
) const
inlineprivate

◆ check_block_timestamp() [4/4]

bool Blockchain::check_block_timestamp ( std::vector< uint64_t > &  timestamps,
const block b,
uint64_t &  median_ts 
) const
private

checks a block's timestamp

If the block is not more recent than the median of the recent timestamps passed here, it is considered invalid.

Parameters
timestampsa list of the most recent timestamps to check against
bthe block to be checked
Returns
true if the block's timestamp is valid, otherwise false

◆ check_blockchain_pruning()

bool Blockchain::check_blockchain_pruning ( )

◆ check_fee()

bool Blockchain::check_fee ( size_t  tx_weight,
uint64_t  fee 
) const

validate a transaction's fee

This function validates the fee is enough for the transaction. This is based on the weight of the transaction, and, after a height threshold, on the average weight of transaction in a past window

Parameters
tx_weightthe transaction weight
feethe fee
Returns
true if the fee is enough, false otherwise

◆ check_for_double_spend()

bool Blockchain::check_for_double_spend ( const transaction tx,
key_images_container keys_this_block 
) const
private

make sure a transaction isn't attempting a double-spend

Parameters
txthe transaction to check
keys_this_blocka cumulative list of spent keys for the current block
Returns
false if a double spend was detected, otherwise true

◆ check_ring_signature()

void Blockchain::check_ring_signature ( const crypto::hash tx_prefix_hash,
const crypto::key_image key_image,
const std::vector< rct::ctkey > &  pubkeys,
const std::vector< crypto::signature > &  sig,
uint64_t &  result 
)
private

validates a transaction input's ring signature

Parameters
tx_prefix_hashthe transaction prefix' hash
key_imagethe key image generated from the true input
pubkeysthe public keys for each input in the ring signature
sigthe signature generated for each input in the ring signature
resultfalse if the ring signature is invalid, otherwise true

◆ check_tx_input()

bool Blockchain::check_tx_input ( size_t  tx_version,
const txin_to_key txin,
const crypto::hash tx_prefix_hash,
const std::vector< crypto::signature > &  sig,
const rct::rctSig rct_signatures,
std::vector< rct::ctkey > &  output_keys,
uint64_t *  pmax_related_block_height 
)
private

collect output public keys of a transaction input set

This function locates all outputs associated with a given input set (mixins) and validates that they exist and are usable (unlocked, unspent is checked elsewhere).

If pmax_related_block_height is not NULL, its value is set to the height of the most recent block which contains an output used in the input set

Parameters
tx_versionthe transaction version
txinthe transaction input
tx_prefix_hashthe transaction prefix hash, for caching organization
sigthe input signature
output_keysreturn-by-reference the public keys of the outputs in the input set
rct_signaturesthe ringCT signatures, which are only valid if tx version > 1
pmax_related_block_heightreturn-by-pointer the height of the most recent block in the input set
Returns
false if any output is not yet unlocked, or is missing, otherwise true

◆ check_tx_inputs() [1/2]

bool Blockchain::check_tx_inputs ( transaction tx,
tx_verification_context tvc,
uint64_t *  pmax_used_block_height = NULL 
)
private

validate a transaction's inputs and their keys

This function validates transaction inputs and their keys. Previously it also performed double spend checking, but that has been moved to its own function. The transaction's rct signatures, if any, are expanded.

If pmax_related_block_height is not NULL, its value is set to the height of the most recent block which contains an output used in any input set

Currently this function calls ring signature validation for each transaction.

Parameters
txthe transaction to validate
tvcreturned information about tx verification
pmax_related_block_heightreturn-by-pointer the height of the most recent block in the input set
Returns
false if any validation step fails, otherwise true

◆ check_tx_inputs() [2/2]

bool Blockchain::check_tx_inputs ( transaction tx,
uint64_t &  pmax_used_block_height,
crypto::hash max_used_block_id,
tx_verification_context tvc,
bool  kept_by_block = false 
)

validates a transaction's inputs

validates a transaction's inputs as correctly used and not previously spent. also returns the hash and height of the most recent block which contains an output that was used as an input to the transaction. The transaction's rct signatures, if any, are expanded.

Parameters
txthe transaction to validate
pmax_used_block_heightreturn-by-reference block height of most recent input
max_used_block_idreturn-by-reference block hash of most recent input
tvcreturned information about tx verification
kept_by_blockwhether or not the transaction is from a previously-verified block
Returns
false if any input is invalid, otherwise true

◆ check_tx_outputs()

bool Blockchain::check_tx_outputs ( const transaction tx,
tx_verification_context tvc 
)

check that a transaction's outputs conform to current standards

This function checks, for example at the time of this writing, that each output is of the form a * 10^b (phrased differently, that if written out would have only one non-zero digit in base 10).

Parameters
txthe transaction to check the outputs of
tvcreturned info about tx verification
Returns
false if any outputs do not conform, otherwise true

◆ cleanup_handle_incoming_blocks()

bool Blockchain::cleanup_handle_incoming_blocks ( bool  force_sync = false)

incoming blocks post-processing, cleanup, and disk sync

Parameters
force_syncif true, and Blockchain is handling syncing to disk, always sync
Returns
true

◆ complete_timestamps_vector()

bool Blockchain::complete_timestamps_vector ( uint64_t  start_height,
std::vector< uint64_t > &  timestamps 
) const
private

finish an alternate chain's timestamp window from the main chain

for an alternate chain, get the timestamps from the main chain to complete the needed number of timestamps for the BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW.

Parameters
start_heightthe alternate chain's attachment height to the main chain
timestampsreturn-by-value the timestamps set to be populated
Returns
true unless start_height is greater than the current blockchain height

◆ create_block_template() [1/2]

bool Blockchain::create_block_template ( block b,
const account_public_address miner_address,
difficulty_type di,
uint64_t &  height,
uint64_t &  expected_reward,
const blobdata ex_nonce 
)

creates a new block to mine against

Parameters
breturn-by-reference block to be filled in
from_blockoptional block hash to start mining from (main chain tip if NULL)
miner_addressaddress new coins for the block will go to
direturn-by-reference tells the miner what the difficulty target is
heightreturn-by-reference tells the miner what height it's mining against
expected_rewardreturn-by-reference the total reward awarded to the miner finding this block, including transaction fees
ex_nonceextra data to be added to the miner transaction's extra
Returns
true if block template filled in successfully, else false

◆ create_block_template() [2/2]

bool Blockchain::create_block_template ( block b,
const crypto::hash from_block,
const account_public_address miner_address,
difficulty_type di,
uint64_t &  height,
uint64_t &  expected_reward,
const blobdata ex_nonce 
)

◆ deinit()

bool Blockchain::deinit ( )

Uninitializes the blockchain state.

Saves to disk any state that needs to be maintained

Returns
true on success, false if any uninitialization steps fail

◆ expand_transaction_2()

bool Blockchain::expand_transaction_2 ( transaction tx,
const crypto::hash tx_prefix_hash,
const std::vector< std::vector< rct::ctkey >> &  pubkeys 
)
private

expands v2 transaction data from blockchain

RingCT transactions do not transmit some of their data if it can be reconstituted by the receiver. This function expands that implicit data.

◆ find_blockchain_supplement() [1/4]

bool Blockchain::find_blockchain_supplement ( const std::list< crypto::hash > &  qblock_ids,
NOTIFY_RESPONSE_CHAIN_ENTRY::request resp 
) const

get recent block hashes for a foreign chain

Find the split point between us and foreign blockchain and return (by reference) the most recent common block hash along with up to BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT additional (more recent) hashes.

Parameters
qblock_idsthe foreign chain's "short history" (see get_short_chain_history)
respreturn-by-reference the split height and subsequent blocks' hashes
Returns
true if a block found in common, else false

◆ find_blockchain_supplement() [2/4]

bool Blockchain::find_blockchain_supplement ( const std::list< crypto::hash > &  qblock_ids,
std::vector< crypto::hash > &  hashes,
uint64_t &  start_height,
uint64_t &  current_height,
bool  clip_pruned 
) const

get recent block hashes for a foreign chain

Find the split point between us and foreign blockchain and return (by reference) the most recent common block hash along with up to BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT additional (more recent) hashes.

Parameters
qblock_idsthe foreign chain's "short history" (see get_short_chain_history)
hashesthe hashes to be returned, return-by-reference
start_heightthe start height, return-by-reference
current_heightthe current blockchain height, return-by-reference
clip_prunedwhether to constrain results to unpruned data
Returns
true if a block found in common, else false

◆ find_blockchain_supplement() [3/4]

bool Blockchain::find_blockchain_supplement ( const std::list< crypto::hash > &  qblock_ids,
uint64_t &  starter_offset 
) const

find the most recent common point between ours and a foreign chain

This function takes a list of block hashes from another node on the network to find where the split point is between us and them. This is used to see what to send another node that needs to sync.

Parameters
qblock_idsthe foreign chain's "short history" (see get_short_chain_history)
starter_offsetreturn-by-reference the most recent common block's height
Returns
true if a block found in common, else false

◆ find_blockchain_supplement() [4/4]

bool Blockchain::find_blockchain_supplement ( const uint64_t  req_start_block,
const std::list< crypto::hash > &  qblock_ids,
std::vector< std::pair< std::pair< cryptonote::blobdata, crypto::hash >, std::vector< std::pair< crypto::hash, cryptonote::blobdata > > > > &  blocks,
uint64_t &  total_height,
uint64_t &  start_height,
bool  pruned,
bool  get_miner_tx_hash,
size_t  max_count 
) const

get recent blocks for a foreign chain

This function gets recent blocks relative to a foreign chain, starting either at a requested height or whatever height is the most recent ours and the foreign chain have in common.

Parameters
req_start_blockif non-zero, specifies a start point (otherwise find most recent commonality)
qblock_idsthe foreign chain's "short history" (see get_short_chain_history)
blocksreturn-by-reference the blocks and their transactions
total_heightreturn-by-reference our current blockchain height
start_heightreturn-by-reference the height of the first block returned
prunedwhether to return full or pruned tx blobs
max_countthe max number of blocks to get
Returns
true if a block found in common or req_start_block specified, else false

◆ flush_txes_from_pool()

bool Blockchain::flush_txes_from_pool ( const std::vector< crypto::hash > &  txids)

remove transactions from the transaction pool (if present)

Parameters
txidsa list of hashes of transactions to be removed
Returns
false if any removals fail, otherwise true

◆ for_all_key_images()

bool Blockchain::for_all_key_images ( std::function< bool(const crypto::key_image &)>  f) const

perform a check on all key images in the blockchain

Parameters
std::functionthe check to perform, pass/fail
Returns
false if any key image fails the check, otherwise true

◆ for_all_outputs() [1/2]

bool Blockchain::for_all_outputs ( std::function< bool(uint64_t amount, const crypto::hash &tx_hash, uint64_t height, size_t tx_idx)>  f) const

perform a check on all outputs in the blockchain

Parameters
std::functionthe check to perform, pass/fail
Returns
false if any output fails the check, otherwise true

◆ for_all_outputs() [2/2]

bool Blockchain::for_all_outputs ( uint64_t  amount,
std::function< bool(uint64_t height)>  f 
) const

perform a check on all outputs of a given amount in the blockchain

Parameters
amountthe amount to iterate through
std::functionthe check to perform, pass/fail
Returns
false if any output fails the check, otherwise true

◆ for_all_transactions()

bool Blockchain::for_all_transactions ( std::function< bool(const crypto::hash &, const cryptonote::transaction &)>  f,
bool  pruned 
) const

perform a check on all transactions in the blockchain

Parameters
std::functionthe check to perform, pass/fail
boolpruned whether to return pruned txes only
Returns
false if any transaction fails the check, otherwise true

◆ for_all_txpool_txes()

bool Blockchain::for_all_txpool_txes ( std::function< bool(const crypto::hash &, const txpool_tx_meta_t &, const cryptonote::blobdata *)>  f,
bool  include_blob = false,
bool  include_unrelayed_txes = true 
) const

◆ for_blocks_range()

bool Blockchain::for_blocks_range ( const uint64_t &  h1,
const uint64_t &  h2,
std::function< bool(uint64_t, const crypto::hash &, const block &)>  f 
) const

perform a check on all blocks in the blockchain in the given range

Parameters
h1the start height
h2the end height
std::functionthe check to perform, pass/fail
Returns
false if any block fails the check, otherwise true

◆ get_adjusted_time()

uint64_t Blockchain::get_adjusted_time ( ) const
private

get the "adjusted time"

Currently this simply returns the current time according to the user's machine.

Returns
the current time

◆ get_alternative_blocks()

bool Blockchain::get_alternative_blocks ( std::vector< block > &  blocks) const

compiles a list of all blocks stored as alternative chains

Parameters
blocksreturn-by-reference container to put result blocks in
Returns
true

◆ get_alternative_blocks_count()

size_t Blockchain::get_alternative_blocks_count ( ) const

returns the number of alternative blocks stored

Returns
the number of alternative blocks stored

◆ get_alternative_chains()

std::list< std::pair< Blockchain::block_extended_info, std::vector< crypto::hash > > > Blockchain::get_alternative_chains ( ) const

returns a set of known alternate chains

Returns
a list of chains

◆ get_block_by_hash()

bool Blockchain::get_block_by_hash ( const crypto::hash h,
block blk,
bool orphan = NULL 
) const

gets the block with a given hash

Parameters
hthe hash to look for
blkreturn-by-reference variable to put result block in
orphanif non-NULL, will be set to true if not in the main chain, false otherwise
Returns
true if the block was found, else false

◆ get_block_id_by_height()

crypto::hash Blockchain::get_block_id_by_height ( uint64_t  height) const

gets a block's hash given a height

Parameters
heightthe height of the block
Returns
the hash of the block at the requested height, or a zeroed hash if there is no such block

◆ get_blockchain_pruning_seed()

uint32_t cryptonote::Blockchain::get_blockchain_pruning_seed ( ) const
inline

◆ get_blocks() [1/3]

template<class t_ids_container , class t_blocks_container , class t_missed_container >
bool Blockchain::get_blocks ( const t_ids_container &  block_ids,
t_blocks_container &  blocks,
t_missed_container &  missed_bs 
) const

gets blocks based on a list of block hashes

Template Parameters
t_ids_containera standard-iterable container
t_blocks_containera standard-iterable container
t_missed_containera standard-iterable container
Parameters
block_idsa container of block hashes for which to get the corresponding blocks
blocksreturn-by-reference a container to store result blocks in
missed_bsreturn-by-reference a container to store missed blocks in
Returns
false if an unexpected exception occurs, else true

◆ get_blocks() [2/3]

bool Blockchain::get_blocks ( uint64_t  start_offset,
size_t  count,
std::vector< std::pair< cryptonote::blobdata, block >> &  blocks 
) const

get blocks from blocks based on start height and count

Parameters
start_offsetthe height on the blockchain to start at
countthe number of blocks to get, if there are as many after start_offset
blocksreturn-by-reference container to put result blocks in
Returns
false if start_offset > blockchain height, else true

◆ get_blocks() [3/3]

bool Blockchain::get_blocks ( uint64_t  start_offset,
size_t  count,
std::vector< std::pair< cryptonote::blobdata, block >> &  blocks,
std::vector< cryptonote::blobdata > &  txs 
) const

get blocks and transactions from blocks based on start height and count

Parameters
start_offsetthe height on the blockchain to start at
countthe number of blocks to get, if there are as many after start_offset
blocksreturn-by-reference container to put result blocks in
txsreturn-by-reference container to put result transactions in
Returns
false if start_offset > blockchain height, else true

◆ get_current_blockchain_height()

uint64_t Blockchain::get_current_blockchain_height ( ) const

get the current height of the blockchain

Returns
the height

◆ get_current_cumulative_block_weight_limit()

uint64_t Blockchain::get_current_cumulative_block_weight_limit ( ) const

gets the block weight limit based on recent blocks

Returns
the limit

◆ get_current_cumulative_block_weight_median()

uint64_t Blockchain::get_current_cumulative_block_weight_median ( ) const

gets the block weight median based on recent blocks (same window as for the limit)

Returns
the median

◆ get_current_hard_fork_version()

uint8_t cryptonote::Blockchain::get_current_hard_fork_version ( ) const
inline

gets the current hardfork version in use/voted for

Returns
the version

◆ get_db() [1/2]

BlockchainDB& cryptonote::Blockchain::get_db ( )
inline

get a reference to the BlockchainDB in use by Blockchain

Returns
a reference to the BlockchainDB instance

◆ get_db() [2/2]

const BlockchainDB& cryptonote::Blockchain::get_db ( ) const
inline

get a reference to the BlockchainDB in use by Blockchain

Returns
a reference to the BlockchainDB instance

◆ get_difficulty_for_next_block()

difficulty_type Blockchain::get_difficulty_for_next_block ( )

returns the difficulty target the next block to be added must meet

Returns
the target

◆ get_difficulty_target()

uint64_t Blockchain::get_difficulty_target ( ) const

get difficulty target based on chain and hardfork version

Returns
difficulty target

◆ get_dynamic_base_fee()

uint64_t Blockchain::get_dynamic_base_fee ( uint64_t  block_reward,
size_t  median_block_weight,
uint8_t  version 
)
static

get dynamic per kB or byte fee for a given block weight

The dynamic fee is based on the block weight in a past window, and the current block reward. It is expressed by kB before v8, and per byte from v8.

Parameters
block_rewardthe current block reward
median_block_weightthe median block weight in the past window
versionhard fork version for rules and constants to use
Returns
the fee

◆ get_dynamic_base_fee_estimate()

uint64_t Blockchain::get_dynamic_base_fee_estimate ( uint64_t  grace_blocks) const

get dynamic per kB or byte fee estimate for the next few blocks

The dynamic fee is based on the block weight in a past window, and the current block reward. It is expressed by kB before v8, and per byte from v8. This function calculates an estimate for a dynamic fee which will be valid for the next grace_blocks

Parameters
grace_blocksnumber of blocks we want the fee to be valid for
Returns
the fee estimate

◆ get_earliest_ideal_height_for_version()

uint64_t cryptonote::Blockchain::get_earliest_ideal_height_for_version ( uint8_t  version) const
inline

returns the earliest block a given version may activate

Returns
the height

◆ get_fee_quantization_mask()

uint64_t Blockchain::get_fee_quantization_mask ( )
static

get fee quantization mask

The dynamic fee may be quantized, to mask out the last decimal places

Returns
the fee quantized mask

◆ get_hard_fork_heights()

const std::vector< HardFork::Params > & Blockchain::get_hard_fork_heights ( network_type  nettype)
static

gets the hardfork heights of given network

Returns
the HardFork object

◆ get_hard_fork_state()

HardFork::State Blockchain::get_hard_fork_state ( ) const

gets the hardfork voting state object

Returns
the HardFork object

◆ get_hard_fork_version()

uint8_t cryptonote::Blockchain::get_hard_fork_version ( uint64_t  height) const
inline

returns the actual hardfork version for a given block height

Parameters
heightthe height for which to check version info
Returns
the version

◆ get_hard_fork_voting_info()

bool Blockchain::get_hard_fork_voting_info ( uint8_t  version,
uint32_t &  window,
uint32_t &  votes,
uint32_t &  threshold,
uint64_t &  earliest_height,
uint8_t &  voting 
) const

get information about hardfork voting for a version

Parameters
versionthe version in question
windowthe size of the voting window
votesthe number of votes to enable <version>
thresholdthe number of votes required to enable <version>
earliest_heightthe earliest height at which <version> is allowed
votingwhich version this node is voting for/using
Returns
whether the version queried is enabled

◆ get_ideal_hard_fork_version() [1/2]

uint8_t cryptonote::Blockchain::get_ideal_hard_fork_version ( ) const
inline

returns the newest hardfork version known to the blockchain

Returns
the version

◆ get_ideal_hard_fork_version() [2/2]

uint8_t cryptonote::Blockchain::get_ideal_hard_fork_version ( uint64_t  height) const
inline

returns the newest hardfork version voted to be enabled as of a certain height

Parameters
heightthe height for which to check version info
Returns
the version

◆ get_last_block_timestamps()

std::vector< time_t > Blockchain::get_last_block_timestamps ( unsigned int  blocks) const

returns the timestamps of the last N blocks

◆ get_last_n_blocks_weights()

void Blockchain::get_last_n_blocks_weights ( std::vector< uint64_t > &  weights,
size_t  count 
) const
private

gets recent block weights for median calculation

get the block weights of the last <count> blocks, and return by reference <weights>.

Parameters
weightsreturn-by-reference the list of weights
countthe number of blocks to get weights for

◆ get_long_term_block_weight_median()

uint64_t Blockchain::get_long_term_block_weight_median ( uint64_t  start_height,
size_t  count 
) const
private

gets block long term weight median

get the block long term weight median of <count> blocks starting at <start_height>

Parameters
start_heightthe block height of the first block to query
countthe number of blocks to get weights for
Returns
the long term median block weight

◆ get_mempool_tx_livetime()

uint32_t Blockchain::get_mempool_tx_livetime ( ) const

◆ get_nettype()

network_type cryptonote::Blockchain::get_nettype ( ) const
inline

get blockchain nettype

◆ get_next_difficulty_for_alternative_chain()

difficulty_type Blockchain::get_next_difficulty_for_alternative_chain ( const std::list< blocks_ext_by_hash::const_iterator > &  alt_chain,
block_extended_info bei 
) const
private

gets the difficulty requirement for a new block on an alternate chain

Parameters
alt_chainthe chain to be added to
beithe block being added (and metadata, see ::block_extended_info)
Returns
the difficulty requirement

◆ get_next_hard_fork_version()

uint8_t cryptonote::Blockchain::get_next_hard_fork_version ( ) const
inline

returns the next hardfork version

Returns
the version

◆ get_next_long_term_block_weight()

uint64_t Blockchain::get_next_long_term_block_weight ( uint64_t  block_weight) const

gets the long term block weight for a new block

Returns
the long term block weight

◆ get_num_mature_outputs()

uint64_t Blockchain::get_num_mature_outputs ( uint64_t  amount) const

get number of outputs of an amount past the minimum spendable age

Parameters
amountthe output amount
Returns
the number of mature outputs

◆ get_output_distribution()

bool Blockchain::get_output_distribution ( uint64_t  amount,
uint64_t  from_height,
uint64_t  to_height,
uint64_t &  start_height,
std::vector< uint64_t > &  distribution,
uint64_t &  base 
) const

gets per block distribution of outputs of a given amount

Parameters
amountthe amount to get a ditribution for
from_heightthe height before which we do not care about the data
to_heightthe height after which we do not care about the data
return-by-referencestart_height the height of the first rct output
return-by-referencedistribution the start offset of the first rct output in this block (same as previous if none)
return-by-referencebase how many outputs of that amount are before the stated distribution

◆ get_output_histogram()

std::map< uint64_t, std::tuple< uint64_t, uint64_t, uint64_t > > Blockchain::get_output_histogram ( const std::vector< uint64_t > &  amounts,
bool  unlocked,
uint64_t  recent_cutoff,
uint64_t  min_count = 0 
) const

return a histogram of outputs on the blockchain

Parameters
amountsoptional set of amounts to lookup
unlockedwhether to restrict instances to unlocked ones
recent_cutofftimestamp to consider outputs as recent
min_countreturn only amounts with at least that many instances
Returns
a set of amount/instances

◆ get_output_key()

crypto::public_key Blockchain::get_output_key ( uint64_t  amount,
uint64_t  global_index 
) const

get the public key for an output

Parameters
amountthe output amount
global_indexthe output amount-global index
Returns
the public key

◆ get_output_key_mask_unlocked()

void Blockchain::get_output_key_mask_unlocked ( const uint64_t &  amount,
const uint64_t &  index,
crypto::public_key key,
rct::key mask,
bool unlocked 
) const

gets an output's key and unlocked state

Parameters
amountin - the output amount
indexin - the output global amount index
maskout - the output's RingCT mask
keyout - the output's key
unlockedout - the output's unlocked state

◆ get_outs()

bool Blockchain::get_outs ( const COMMAND_RPC_GET_OUTPUTS_BIN::request req,
COMMAND_RPC_GET_OUTPUTS_BIN::response res 
) const

gets specific outputs to mix with

This function takes an RPC request for outputs to mix with and creates an RPC response with the resultant output indices.

Outputs to mix with are specified in the request.

Parameters
reqthe outputs to return
resreturn-by-reference the resultant output indices and keys
Returns
true

◆ get_short_chain_history()

bool Blockchain::get_short_chain_history ( std::list< crypto::hash > &  ids) const

gets the hashes for a subset of the blockchain

puts into list <ids> a list of hashes representing certain blocks from the blockchain in reverse chronological order

the blocks chosen, at the time of this writing, are: the most recent 11 powers of 2 less recent from there, so 13, 17, 25, etc...

Parameters
idsreturn-by-reference list to put the resulting hashes in
Returns
true

◆ get_split_transactions_blobs()

template<class t_ids_container , class t_tx_container , class t_missed_container >
template bool cryptonote::Blockchain::get_split_transactions_blobs ( const t_ids_container &  txs_ids,
t_tx_container &  txs,
t_missed_container &  missed_txs 
) const

◆ get_tail_id() [1/2]

crypto::hash Blockchain::get_tail_id ( ) const

get the hash of the most recent block on the blockchain

Returns
the hash

◆ get_tail_id() [2/2]

crypto::hash Blockchain::get_tail_id ( uint64_t &  height) const

get the height and hash of the most recent block on the blockchain

Parameters
heightreturn-by-reference variable to store the height in
Returns
the hash

◆ get_total_transactions()

size_t Blockchain::get_total_transactions ( ) const

gets the total number of transactions on the main chain

Returns
the number of transactions on the main chain

◆ get_transactions()

template<class t_ids_container , class t_tx_container , class t_missed_container >
template bool cryptonote::Blockchain::get_transactions ( const t_ids_container &  txs_ids,
t_tx_container &  txs,
t_missed_container &  missed_txs 
) const

◆ get_transactions_blobs()

template<class t_ids_container , class t_tx_container , class t_missed_container >
template bool cryptonote::Blockchain::get_transactions_blobs ( const t_ids_container &  txs_ids,
t_tx_container &  txs,
t_missed_container &  missed_txs,
bool  pruned = false 
) const

gets transactions based on a list of transaction hashes

Template Parameters
t_ids_containera standard-iterable container
t_tx_containera standard-iterable container
t_missed_containera standard-iterable container
Parameters
txs_idsa container of hashes for which to get the corresponding transactions
txsreturn-by-reference a container to store result transactions in
missed_txsreturn-by-reference a container to store missed transactions in
prunedwhether to return full or pruned blobs
Returns
false if an unexpected exception occurs, else true

◆ get_tx_outputs_gindexs() [1/2]

bool Blockchain::get_tx_outputs_gindexs ( const crypto::hash tx_id,
size_t  n_txes,
std::vector< std::vector< uint64_t >> &  indexs 
) const

◆ get_tx_outputs_gindexs() [2/2]

bool Blockchain::get_tx_outputs_gindexs ( const crypto::hash tx_id,
std::vector< uint64_t > &  indexs 
) const

gets the global indices for outputs from a given transaction

This function gets the global indices for all outputs belonging to a specific transaction.

Parameters
tx_idthe hash of the transaction to fetch indices for
indexsreturn-by-reference the global indices for the transaction's outputs
n_txeshow many txes in a row to get results for
Returns
false if the transaction does not exist, or if no indices are found, otherwise true

◆ get_txpool_tx_blob() [1/2]

cryptonote::blobdata Blockchain::get_txpool_tx_blob ( const crypto::hash txid) const

◆ get_txpool_tx_blob() [2/2]

bool Blockchain::get_txpool_tx_blob ( const crypto::hash txid,
cryptonote::blobdata bd 
) const

◆ get_txpool_tx_count()

uint64_t Blockchain::get_txpool_tx_count ( bool  include_unrelayed_txes = true) const

◆ get_txpool_tx_meta()

bool Blockchain::get_txpool_tx_meta ( const crypto::hash txid,
txpool_tx_meta_t meta 
) const

◆ get_validator_by_height()

electroneum::basic::Validator Blockchain::get_validator_by_height ( uint64_t  height)

◆ handle_alternative_block()

bool Blockchain::handle_alternative_block ( const block b,
const crypto::hash id,
block_verification_context bvc 
)
private

validate and add a new block to an alternate blockchain

If a block to be added does not belong to the main chain, but there is an alternate chain to which it should be added, that is handled here.

Parameters
bthe block to be added
idthe hash of the block
bvcmetadata concerning the block's validity
Returns
true if the block was added successfully, otherwise false

◆ handle_block_to_main_chain() [1/2]

bool Blockchain::handle_block_to_main_chain ( const block bl,
block_verification_context bvc 
)
private

validate and add a new block to the end of the blockchain

This function is merely a convenience wrapper around the other of the same name. This one passes the block's hash to the other as well as the block and verification context.

Parameters
blthe block to be added
bvcmetadata concerning the block's validity
Returns
true if the block was added successfully, otherwise false

◆ handle_block_to_main_chain() [2/2]

bool Blockchain::handle_block_to_main_chain ( const block bl,
const crypto::hash id,
block_verification_context bvc 
)
private

validate and add a new block to the end of the blockchain

When a block is given to Blockchain to be added to the blockchain, it is passed here if it is determined to belong at the end of the current chain.

Parameters
blthe block to be added
idthe hash of the block
bvcmetadata concerning the block's validity
Returns
true if the block was added successfully, otherwise false

◆ handle_get_objects()

bool Blockchain::handle_get_objects ( NOTIFY_REQUEST_GET_OBJECTS::request arg,
NOTIFY_RESPONSE_GET_OBJECTS::request rsp 
)

retrieves a set of blocks and their transactions, and possibly other transactions

the request object encapsulates a list of block hashes and a (possibly empty) list of transaction hashes. for each block hash, the block is fetched along with all of that block's transactions. Any transactions requested separately are fetched afterwards.

Parameters
argthe request
rspreturn-by-reference the response to fill in
Returns
true unless any blocks or transactions are missing

◆ have_block()

bool Blockchain::have_block ( const crypto::hash id) const

checks if a block is known about with a given hash

This function checks the main chain, alternate chains, and invalid blocks for a block with the given hash

Parameters
idthe hash to search for
Returns
true if the block is known, else false

◆ have_tx()

bool Blockchain::have_tx ( const crypto::hash id) const

search the blockchain for a transaction by hash

Parameters
idthe hash to search for
Returns
true if the tx exists, else false

◆ have_tx_keyimg_as_spent()

bool Blockchain::have_tx_keyimg_as_spent ( const crypto::key_image key_im) const

check if a key image is already spent on the blockchain

Whenever a transaction output is used as an input for another transaction (a true input, not just one of a mixing set), a key image is generated and stored in the transaction in order to prevent double spending. If this key image is seen again, the transaction using it is rejected.

Parameters
key_imthe key image to search for
Returns
true if the key image is already spent in the blockchain, else false

◆ have_tx_keyimges_as_spent()

bool Blockchain::have_tx_keyimges_as_spent ( const transaction tx) const

check if any key image in a transaction has already been spent

Parameters
txthe transaction to check
Returns
true if any key image is already spent in the blockchain, else false

◆ init() [1/2]

bool Blockchain::init ( BlockchainDB db,
const network_type  nettype = MAINNET,
bool  offline = false,
const cryptonote::test_options test_options = NULL,
difficulty_type  fixed_difficulty = 0,
const GetCheckpointsCallback get_checkpoints = nullptr,
bool  ignore_bsig = false,
bool  fallback_to_pow = false 
)

Initialize the Blockchain state.

Parameters
dba pointer to the backing store to use for the blockchain
nettypenetwork type
offlinetrue if running offline, else false
test_optionstest parameters
fixed_difficultyfixed difficulty for testing purposes; 0 means disabled
get_checkpointsif set, will be called to get checkpoints data
Returns
true on success, false if any initialization steps fail

◆ init() [2/2]

bool Blockchain::init ( BlockchainDB db,
HardFork *&  hf,
const network_type  nettype = MAINNET,
bool  offline = false 
)

Initialize the Blockchain state.

Parameters
dba pointer to the backing store to use for the blockchain
hfa structure containing hardfork information
nettypenetwork type
offlinetrue if running offline, else false
Returns
true on success, false if any initialization steps fail

◆ invalidate_block_template_cache()

void Blockchain::invalidate_block_template_cache ( )
private

invalidates any cached block template

◆ is_tx_spendtime_unlocked()

bool Blockchain::is_tx_spendtime_unlocked ( uint64_t  unlock_time) const
private

checks if a transaction is unlocked (its outputs spendable)

This function checks to see if a transaction is unlocked. unlock_time is either a block index or a unix time.

Parameters
unlock_timethe unlock parameter (height or time)
Returns
true if spendable, otherwise false

◆ is_within_compiled_block_hash_area() [1/2]

bool cryptonote::Blockchain::is_within_compiled_block_hash_area ( ) const
inline

◆ is_within_compiled_block_hash_area() [2/2]

bool Blockchain::is_within_compiled_block_hash_area ( uint64_t  height) const

◆ load_compiled_in_block_hashes()

void cryptonote::Blockchain::load_compiled_in_block_hashes ( const GetCheckpointsCallback get_checkpoints)
private

loads block hashes from compiled-in data set

A (possibly empty) set of block hashes can be compiled into the electroneum daemon binary. This function loads those hashes into a useful state.

Parameters
get_checkpointsif set, will be called to get checkpoints data

◆ lock()

void Blockchain::lock ( )

◆ normalize_v7_difficulties()

void Blockchain::normalize_v7_difficulties ( )

Normalize the cumulative difficulty for V7 blocks, fixing the differing difficulty among nodes.

◆ on_new_tx_from_block()

void Blockchain::on_new_tx_from_block ( const cryptonote::transaction tx)

called when we see a tx originating from a block

Used for handling txes from historical blocks in a fast way

◆ output_scan_worker()

void Blockchain::output_scan_worker ( const uint64_t  amount,
const std::vector< uint64_t > &  offsets,
std::vector< output_data_t > &  outputs 
) const

get a number of outputs of a specific amount

Parameters
amountthe amount
offsetsthe indices (indexed to the amount) of the outputs
outputsreturn-by-reference the outputs collected

◆ pop_block_from_blockchain()

block Blockchain::pop_block_from_blockchain ( )
private

removes the most recent block from the blockchain

Returns
the block removed

◆ pop_blocks()

void Blockchain::pop_blocks ( uint64_t  nblocks)

removes blocks from the top of the blockchain

Parameters
nblocksnumber of blocks to be removed

◆ prepare_handle_incoming_blocks()

bool Blockchain::prepare_handle_incoming_blocks ( const std::vector< block_complete_entry > &  blocks_entry,
std::vector< block > &  blocks 
)

performs some preprocessing on a group of incoming blocks to speed up verification

Parameters
blocks_entrya list of incoming blocks
blocksthe parsed blocks
Returns
false on erroneous blocks, else true

◆ prevalidate_miner_transaction()

bool Blockchain::prevalidate_miner_transaction ( const block b,
uint64_t  height 
)
private

sanity checks a miner transaction before validating an entire block

This function merely checks basic things like the structure of the miner transaction, the unlock time, and that the amount doesn't overflow.

Parameters
bthe block containing the miner transaction
heightthe height at which the block will be added
Returns
false if anything is found wrong with the miner transaction, otherwise true

◆ prune_blockchain()

bool Blockchain::prune_blockchain ( uint32_t  pruning_seed = 0)

◆ remove_txpool_tx()

void Blockchain::remove_txpool_tx ( const crypto::hash txid)

◆ reset_and_set_genesis_block()

bool Blockchain::reset_and_set_genesis_block ( const block b)

clears the blockchain and starts a new one

Parameters
bthe first block in the new chain (the genesis block)
Returns
true on success, else false

◆ return_tx_to_pool()

void Blockchain::return_tx_to_pool ( std::vector< std::pair< transaction, blobdata >> &  txs)
private

◆ rollback_blockchain_switching()

bool Blockchain::rollback_blockchain_switching ( std::list< block > &  original_chain,
uint64_t  rollback_height 
)
private

reverts the blockchain to its previous state following a failed switch

If Blockchain fails to switch to an alternate chain when it means to do so, this function reverts the blockchain to how it was before the attempted switch.

Parameters
original_chainthe chain to switch back to
rollback_heightthe height to revert to before appending the original chain
Returns
false if something goes wrong with reverting (very bad), otherwise true

◆ safesyncmode()

void Blockchain::safesyncmode ( const bool  onoff)

Put DB in safe sync mode.

◆ scan_outputkeys_for_indexes()

template<class visitor_t >
bool Blockchain::scan_outputkeys_for_indexes ( size_t  tx_version,
const txin_to_key tx_in_to_key,
visitor_t &  vis,
const crypto::hash tx_prefix_hash,
uint64_t *  pmax_related_block_height = NULL 
) const
inlineprivate

collects the keys for all outputs being "spent" as an input

This function makes sure that each "input" in an input (mixins) exists and collects the public key for each from the transaction it was included in via the visitor passed to it.

If pmax_related_block_height is not NULL, its value is set to the height of the most recent block which contains an output used in the input set

Template Parameters
visitor_ta class encapsulating tx is unlocked and collect tx key
Parameters
tx_in_to_keya transaction input instance
visan instance of the visitor to use
tx_prefix_hashthe hash of the associated transaction_prefix
pmax_related_block_heightreturn-by-pointer the height of the most recent block in the input set
tx_versionversion of the tx, if > 1 we also get commitments
Returns
false if any keys are not found or any inputs are not unlocked, otherwise true

◆ set_block_notify()

void cryptonote::Blockchain::set_block_notify ( const std::shared_ptr< tools::Notify > &  notify)
inline

sets a block notify object to call for every new block

Parameters
notifythe notify object to call at every new block

◆ set_checkpoints()

void cryptonote::Blockchain::set_checkpoints ( checkpoints &&  chk_pts)
inline

assign a set of blockchain checkpoint hashes

Parameters
chk_ptsthe set of checkpoints to assign

◆ set_enforce_dns_checkpoints()

void Blockchain::set_enforce_dns_checkpoints ( bool  enforce)

configure whether or not to enforce DNS-based checkpoints

Parameters
enforcethe new enforcement setting

◆ set_reorg_notify()

void cryptonote::Blockchain::set_reorg_notify ( const std::shared_ptr< tools::Notify > &  notify)
inline

sets a reorg notify object to call for every reorg

Parameters
notifythe notify object to call at every reorg

◆ set_show_time_stats()

void cryptonote::Blockchain::set_show_time_stats ( bool  stats)
inline

set whether or not to show/print time statistics

Parameters
statsthe new time stats setting

◆ set_user_options()

void Blockchain::set_user_options ( uint64_t  maxthreads,
bool  sync_on_blocks,
uint64_t  sync_threshold,
blockchain_db_sync_mode  sync_mode,
bool  fast_sync,
std::string  validator_key 
)

Update the validators public key by fetching data from electroneum's endpoint.

Returns
true if successfull

sets various performance options

Parameters
maxthreadsmax number of threads when preparing blocks for addition
sync_on_blockswhether to sync based on blocks or bytes
sync_thresholdnumber of blocks/bytes to cache before syncing to database
sync_modethe blockchain_db_sync_mode to use
fast_syncsync using built-in block hashes as trusted

◆ set_validator_key()

void cryptonote::Blockchain::set_validator_key ( std::string  key)
inline

set validator key

◆ set_validators_list_instance()

void cryptonote::Blockchain::set_validators_list_instance ( std::unique_ptr< electroneum::basic::Validators > &  v)
inline

◆ sign_block()

void Blockchain::sign_block ( block b,
std::string  privateKey 
)
private

Digitally sign the block.

Parameters
bthe block to be digitally signed
privateKeykey to generate the signature

◆ store_blockchain()

bool Blockchain::store_blockchain ( )

stores the blockchain

If Blockchain is handling storing of the blockchain (rather than BlockchainDB), this initiates a blockchain save.

Returns
true unless saving the blockchain fails

◆ switch_to_alternative_blockchain()

bool Blockchain::switch_to_alternative_blockchain ( std::list< blocks_ext_by_hash::const_iterator > &  alt_chain,
bool  discard_disconnected_chain 
)
private

performs a blockchain reorganization according to the longest chain rule

This function aggregates all the actions necessary to switch to a newly-longer chain. If any step in the reorganization process fails, the blockchain is reverted to its previous state.

Parameters
alt_chainthe chain to switch to
discard_disconnected_chainwhether or not to keep the old chain as an alternate
Returns
false if the reorganization fails, otherwise true

◆ unlock()

void Blockchain::unlock ( )

◆ update_blockchain_pruning()

bool Blockchain::update_blockchain_pruning ( )

◆ update_checkpoints()

bool Blockchain::update_checkpoints ( const std::string &  file_path,
bool  check_dns 
)

loads new checkpoints from a file and optionally from DNS

Parameters
file_paththe path of the file to look for and load checkpoints from
check_dnswhether or not to check for new DNS-based checkpoints
Returns
false if any enforced checkpoint type fails to load, otherwise true

◆ update_next_cumulative_weight_limit()

bool Blockchain::update_next_cumulative_weight_limit ( uint64_t *  long_term_effective_median_block_weight = NULL)
private

calculate the block weight limit for the next block to be added

Parameters
long_term_effective_median_block_weightoptionally return that value
Returns
true

◆ update_txpool_tx()

void Blockchain::update_txpool_tx ( const crypto::hash txid,
const txpool_tx_meta_t meta 
)

◆ validate_miner_transaction()

bool Blockchain::validate_miner_transaction ( const block b,
size_t  cumulative_block_weight,
uint64_t  fee,
uint64_t &  base_reward,
uint64_t  already_generated_coins,
bool partial_block_reward,
uint8_t  version 
)
private

validates a miner (coinbase) transaction

This function makes sure that the miner calculated his reward correctly and that his miner transaction totals reward + fee.

Parameters
bthe block containing the miner transaction to be validated
cumulative_block_weightthe block's weight
feethe total fees collected in the block
base_rewardreturn-by-reference the new block's generated coins
already_generated_coinsthe amount of currency generated prior to this block
partial_block_rewardreturn-by-reference true if miner accepted only partial reward
versionhard fork version for that transaction
Returns
false if anything is found wrong with the miner transaction, otherwise true

◆ verify_block_signature()

bool Blockchain::verify_block_signature ( const block b)
private

Verify block's digital signature.

Parameters
bblock to be verified

Member Data Documentation

◆ m_alternative_chains

blocks_ext_by_hash cryptonote::Blockchain::m_alternative_chains
private

◆ m_async_pool

boost::thread_group cryptonote::Blockchain::m_async_pool
private

◆ m_async_service

boost::asio::io_service cryptonote::Blockchain::m_async_service
private

◆ m_async_work_idle

std::unique_ptr<boost::asio::io_service::work> cryptonote::Blockchain::m_async_work_idle
private

◆ m_batch_success

bool cryptonote::Blockchain::m_batch_success
private

◆ m_block_notify

std::shared_ptr<tools::Notify> cryptonote::Blockchain::m_block_notify
private

◆ m_blockchain_lock

epee::critical_section cryptonote::Blockchain::m_blockchain_lock
mutableprivate

◆ m_blocks_hash_check

std::vector<crypto::hash> cryptonote::Blockchain::m_blocks_hash_check
private

◆ m_blocks_longhash_table

std::unordered_map<crypto::hash, crypto::hash> cryptonote::Blockchain::m_blocks_longhash_table
private

◆ m_blocks_txs_check

std::vector<crypto::hash> cryptonote::Blockchain::m_blocks_txs_check
private

◆ m_btc

block cryptonote::Blockchain::m_btc
private

◆ m_btc_address

account_public_address cryptonote::Blockchain::m_btc_address
private

◆ m_btc_difficulty

difficulty_type cryptonote::Blockchain::m_btc_difficulty
private

◆ m_btc_expected_reward

uint64_t cryptonote::Blockchain::m_btc_expected_reward
private

◆ m_btc_height

uint64_t cryptonote::Blockchain::m_btc_height
private

◆ m_btc_nonce

blobdata cryptonote::Blockchain::m_btc_nonce
private

◆ m_btc_pool_cookie

uint64_t cryptonote::Blockchain::m_btc_pool_cookie
private

◆ m_btc_valid

bool cryptonote::Blockchain::m_btc_valid
private

◆ m_bytes_to_sync

uint64_t cryptonote::Blockchain::m_bytes_to_sync
private

◆ m_cancel

std::atomic<bool> cryptonote::Blockchain::m_cancel
private

◆ m_check_txin_table

std::unordered_map<crypto::hash, std::unordered_map<crypto::key_image, bool> > cryptonote::Blockchain::m_check_txin_table
private

◆ m_checkpoints

checkpoints cryptonote::Blockchain::m_checkpoints
private

◆ m_current_block_cumul_weight_limit

size_t cryptonote::Blockchain::m_current_block_cumul_weight_limit
private

◆ m_current_block_cumul_weight_median

size_t cryptonote::Blockchain::m_current_block_cumul_weight_median
private

◆ m_db

BlockchainDB* cryptonote::Blockchain::m_db
private

◆ m_db_default_sync

bool cryptonote::Blockchain::m_db_default_sync
private

◆ m_db_sync_mode

blockchain_db_sync_mode cryptonote::Blockchain::m_db_sync_mode
private

◆ m_db_sync_on_blocks

bool cryptonote::Blockchain::m_db_sync_on_blocks
private

◆ m_db_sync_threshold

uint64_t cryptonote::Blockchain::m_db_sync_threshold
private

◆ m_difficulties

std::vector<difficulty_type> cryptonote::Blockchain::m_difficulties
private

◆ m_difficulty_for_next_block

difficulty_type cryptonote::Blockchain::m_difficulty_for_next_block
private

◆ m_difficulty_for_next_block_top_hash

crypto::hash cryptonote::Blockchain::m_difficulty_for_next_block_top_hash
private

◆ m_difficulty_lock

epee::critical_section cryptonote::Blockchain::m_difficulty_lock
private

◆ m_enforce_dns_checkpoints

bool cryptonote::Blockchain::m_enforce_dns_checkpoints
private

◆ m_fake_pow_calc_time

uint64_t cryptonote::Blockchain::m_fake_pow_calc_time
private

◆ m_fake_scan_time

uint64_t cryptonote::Blockchain::m_fake_scan_time
private

◆ m_fallback_to_pow

bool cryptonote::Blockchain::m_fallback_to_pow
private

◆ m_fast_sync

bool cryptonote::Blockchain::m_fast_sync
private

◆ m_fixed_difficulty

difficulty_type cryptonote::Blockchain::m_fixed_difficulty
private

◆ m_hardfork

HardFork* cryptonote::Blockchain::m_hardfork
private

◆ m_ignore_bsig

bool cryptonote::Blockchain::m_ignore_bsig
private

◆ m_invalid_blocks

blocks_ext_by_hash cryptonote::Blockchain::m_invalid_blocks
private

◆ m_long_term_block_weights_cache_rolling_median

epee::misc_utils::rolling_median_t<uint64_t> cryptonote::Blockchain::m_long_term_block_weights_cache_rolling_median
mutableprivate

◆ m_long_term_block_weights_cache_tip_hash

crypto::hash cryptonote::Blockchain::m_long_term_block_weights_cache_tip_hash
mutableprivate

◆ m_long_term_block_weights_window

uint64_t cryptonote::Blockchain::m_long_term_block_weights_window
private

◆ m_long_term_effective_median_block_weight

uint64_t cryptonote::Blockchain::m_long_term_effective_median_block_weight
private

◆ m_max_prepare_blocks_threads

uint64_t cryptonote::Blockchain::m_max_prepare_blocks_threads
private

◆ m_nettype

network_type cryptonote::Blockchain::m_nettype
private

◆ m_offline

bool cryptonote::Blockchain::m_offline
private

◆ m_reorg_notify

std::shared_ptr<tools::Notify> cryptonote::Blockchain::m_reorg_notify
private

◆ m_scan_table

std::unordered_map<crypto::hash, std::unordered_map<crypto::key_image, std::vector<output_data_t> > > cryptonote::Blockchain::m_scan_table
private

◆ m_show_time_stats

bool cryptonote::Blockchain::m_show_time_stats
private

◆ m_sync_counter

uint64_t cryptonote::Blockchain::m_sync_counter
private

◆ m_timestamps

std::vector<uint64_t> cryptonote::Blockchain::m_timestamps
private

◆ m_timestamps_and_difficulties_height

uint64_t cryptonote::Blockchain::m_timestamps_and_difficulties_height
private

◆ m_transactions

transactions_container cryptonote::Blockchain::m_transactions
private

◆ m_tx_pool

tx_memory_pool& cryptonote::Blockchain::m_tx_pool
private

◆ m_validator_key

std::string cryptonote::Blockchain::m_validator_key
private

◆ m_validators

electroneum::basic::Validators* cryptonote::Blockchain::m_validators
private

◆ m_validators_public_keys

std::vector<std::string> cryptonote::Blockchain::m_validators_public_keys
private

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