Monero
Loading...
Searching...
No Matches
cryptonote::core Class Referencefinal

handles core cryptonote functionality More...

#include <cryptonote_core.h>

Inheritance diagram for cryptonote::core:
Collaboration diagram for cryptonote::core:

Public Member Functions

 core (i_cryptonote_protocol *pprotocol)
 constructor
bool handle_get_objects (NOTIFY_REQUEST_GET_OBJECTS::request &arg, NOTIFY_RESPONSE_GET_OBJECTS::request &rsp, cryptonote_connection_context &context)
 retrieves a set of blocks and their transactions, and possibly other transactions
bool on_idle ()
 calls various idle routines
bool handle_incoming_tx (const blobdata &tx_blob, tx_verification_context &tvc, relay_method tx_relay, bool relayed)
 handles an incoming transaction
bool handle_single_incoming_block (const blobdata &block_blob, const block *b, block_verification_context &bvc, pool_supplement &extra_block_txs, bool update_miner_blocktemplate=true)
 handles a single incoming block
bool handle_incoming_block (const blobdata &block_blob, const block *b, block_verification_context &bvc, bool update_miner_blocktemplate=true)
 handles an incoming block as part of a batch
bool handle_incoming_block (const blobdata &block_blob, const block *b, block_verification_context &bvc, pool_supplement &extra_block_txs, bool update_miner_blocktemplate=true)
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
bool cleanup_handle_incoming_blocks (bool force_sync=false)
 incoming blocks post-processing, cleanup, and disk sync
bool check_incoming_block_size (const blobdata &block_blob) const
 check the size of a block against the current maximum
i_cryptonote_protocolget_protocol ()
 get the cryptonote protocol instance
virtual bool handle_block_found (block &b, block_verification_context &bvc) override
 stores and relays a block found by a miner
virtual bool get_block_template (block &b, const account_public_address &adr, difficulty_type &diffic, uint64_t &height, uint64_t &expected_reward, const blobdata &ex_nonce, uint64_t &seed_height, crypto::hash &seed_hash) override
 creates a new block to mine against
virtual bool get_block_template (block &b, const crypto::hash *prev_block, const account_public_address &adr, difficulty_type &diffic, uint64_t &height, uint64_t &expected_reward, const blobdata &ex_nonce, uint64_t &seed_height, crypto::hash &seed_hash)
bool get_miner_data (uint8_t &major_version, uint64_t &height, crypto::hash &prev_id, crypto::hash &seed_hash, difficulty_type &difficulty, uint64_t &median_weight, uint64_t &already_generated_coins, std::vector< tx_block_template_backlog_entry > &tx_backlog)
 gets data required to create a block template and start mining on it
virtual void on_transactions_relayed (epee::span< const cryptonote::blobdata > tx_blobs, relay_method tx_relay) final
 called when a transaction is relayed.
minerget_miner ()
 gets the miner instance
const minerget_miner () const
 gets the miner instance (const)
bool init (const boost::program_options::variables_map &vm, const test_options *test_options=NULL, const GetCheckpointsCallback &get_checkpoints=nullptr, bool allow_dns=true)
 initializes the core as needed
bool set_genesis_block (const block &b)
 clears the blockchain and starts a new one
bool deinit ()
 performs safe shutdown steps for core and core components
void test_drop_download ()
 sets to drop blocks downloaded (for testing)
void test_drop_download_height (uint64_t height)
 sets to drop blocks downloaded below a certain height
bool get_test_drop_download () const
 gets whether or not to drop blocks (for testing)
bool get_test_drop_download_height () const
 gets whether or not to drop blocks
virtual uint64_t get_current_blockchain_height () const final
 get the current height of the blockchain
void get_blockchain_top (uint64_t &height, crypto::hash &top_id) const
 get the hash and height of the most recent block
bool get_blocks (uint64_t start_offset, size_t count, std::vector< std::pair< cryptonote::blobdata, block > > &blocks, std::vector< cryptonote::blobdata > &txs) const
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
bool get_blocks (uint64_t start_offset, size_t count, std::vector< block > &blocks) const
 get blocks from blocks based on start height and count
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
crypto::hash get_block_id_by_height (uint64_t height) const
 gets a block's hash given a height
bool get_transactions (const std::vector< crypto::hash > &txs_ids, std::vector< cryptonote::blobdata > &txs, std::vector< crypto::hash > &missed_txs, bool pruned=false) const
bool get_split_transactions_blobs (const std::vector< crypto::hash > &txs_ids, std::vector< std::tuple< crypto::hash, cryptonote::blobdata, crypto::hash, cryptonote::blobdata > > &txs, std::vector< crypto::hash > &missed_txs) const
bool get_transactions (const std::vector< crypto::hash > &txs_ids, std::vector< transaction > &txs, std::vector< crypto::hash > &missed_txs, bool pruned=false) const
bool get_block_by_hash (const crypto::hash &h, block &blk, bool *orphan=NULL) const
 gets the block with a given hash
bool get_alternative_blocks (std::vector< block > &blocks) const
 compiles a list of all blocks stored as alternative chains
size_t get_alternative_blocks_count () const
 returns the number of alternative blocks stored
void set_cryptonote_protocol (i_cryptonote_protocol *pprotocol)
 set the pointer to the cryptonote protocol object to use
const checkpointsget_checkpoints () const
 get a set of blockchain checkpoint hashes
void set_checkpoints (checkpoints &&chk_pts)
 assign a set of blockchain checkpoint hashes
void set_checkpoints_file_path (const std::string &path)
 set the file path to read from when loading checkpoints
void set_enforce_dns_checkpoints (bool enforce_dns)
 set whether or not we enforce DNS checkpoints
void disable_dns_checkpoints (bool disable=true)
 set whether or not to enable or disable DNS checkpoints
bool pool_has_tx (const crypto::hash &txid) const
 checks if the pool has a transaction with the given hash
bool get_pool_transactions (std::vector< transaction > &txs, bool include_sensitive_txes=false) const
 get a list of all transactions in the pool
bool get_txpool_backlog (std::vector< tx_backlog_entry > &backlog, bool include_sensitive_txes=false) const
bool get_pool_transaction_hashes (std::vector< crypto::hash > &txs, bool include_sensitive_txes=false) const
 get a list of all transactions in the pool
bool get_pool_transactions_info (const std::vector< crypto::hash > &txids, std::vector< std::pair< crypto::hash, tx_memory_pool::tx_details > > &txs, bool include_sensitive_txes=false) const
bool get_pool_info (time_t start_time, bool include_sensitive_txes, size_t max_tx_count, std::vector< std::pair< crypto::hash, tx_memory_pool::tx_details > > &added_txs, std::vector< crypto::hash > &remaining_added_txids, std::vector< crypto::hash > &removed_txs, bool &incremental) const
 get info necessary for update of pool-related info in a wallet, preferably incremental
bool get_pool_transaction_stats (struct txpool_stats &stats, bool include_sensitive_txes=false) const
 get a list of all transactions in the pool
bool get_pool_transaction (const crypto::hash &id, cryptonote::blobdata &tx, relay_category tx_category) const
 get a specific transaction from the pool
bool get_pool_transactions_and_spent_keys_info (std::vector< tx_info > &tx_infos, std::vector< spent_key_image_info > &key_image_infos, bool include_sensitive_txes=false) const
bool get_pool_for_rpc (std::vector< cryptonote::rpc::tx_in_pool > &tx_infos, cryptonote::rpc::key_images_with_tx_hashes &key_image_infos) const
 get information about all transactions and key images in the pool
size_t get_pool_transactions_count (bool include_sensitive_txes=false) const
 get the total number of transactions in the pool
size_t get_blockchain_total_transactions () const
 gets the total number of transactions on the main chain
bool have_block_unlocked (const crypto::hash &id, int *where=NULL) const
bool have_block (const crypto::hash &id, int *where=NULL) const
bool get_short_chain_history (std::list< crypto::hash > &ids, uint64_t &current_height) const
 gets the hashes for a subset of the blockchain
bool find_blockchain_supplement (const std::list< crypto::hash > &qblock_ids, bool clip_pruned, NOTIFY_RESPONSE_CHAIN_ENTRY::request &resp) const
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_block_count, size_t max_tx_count) const
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
bool get_tx_outputs_gindexs (const crypto::hash &tx_id, size_t n_txes, std::vector< std::vector< uint64_t > > &indexs) const
crypto::hash get_tail_id () const
 get the hash of the most recent block on the blockchain
difficulty_type get_block_cumulative_difficulty (uint64_t height) const
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
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
void pause_mine ()
void resume_mine ()
Blockchainget_blockchain_storage ()
 gets the Blockchain instance
const Blockchainget_blockchain_storage () const
 gets the Blockchain instance (const)
std::string print_pool (bool short_format) const
 get a string containing human-readable pool information
virtual bool is_synchronized () const final
 gets the core synchronization status
void on_synchronized ()
void safesyncmode (const bool onoff)
 Put DB in safe sync mode.
void set_target_blockchain_height (uint64_t target_blockchain_height)
 sets the target blockchain height
uint64_t get_target_blockchain_height () const
 gets the target blockchain height
uint8_t get_ideal_hard_fork_version () const
 returns the newest hardfork version known to the blockchain
uint8_t get_ideal_hard_fork_version (uint64_t height) const
 return the ideal hard fork version for a given block height
uint8_t get_hard_fork_version (uint64_t height) const
 return the hard fork version for a given block height
uint64_t get_earliest_ideal_height_for_version (uint8_t version) const
 return the earliest block a given version may activate
std::time_t get_start_time () const
 gets start_time
bool update_checkpoints (const bool skip_dns=false)
 tells the Blockchain to update its checkpoints
void graceful_exit ()
 tells the daemon to wind down operations and stop running
void stop ()
 stops the daemon running
bool is_key_image_spent (const crypto::key_image &key_im) const
 check if a key image is already spent on the blockchain
bool are_key_images_spent (const std::vector< crypto::key_image > &key_im, std::vector< bool > &spent) const
 check if multiple key images are spent
bool are_key_images_spent_in_pool (const std::vector< crypto::key_image > &key_im, std::vector< bool > &spent) const
 check if multiple key images are spent in the transaction pool
size_t get_block_sync_size (uint64_t height) const
 get the number of blocks to sync in one go
std::pair< boost::multiprecision::uint128_t, boost::multiprecision::uint128_t > get_coinbase_tx_sum (const uint64_t start_offset, const size_t count)
 get the sum of coinbase tx amounts between blocks
network_type get_nettype () const
 get the network type we're on
bool is_update_available () const
 check whether an update is known to be available or not
uint64_t prevalidate_block_hashes (uint64_t height, const std::vector< crypto::hash > &hashes, const std::vector< uint64_t > &weights)
 check a set of hashes against the precompiled hash set
uint64_t get_free_space () const
 get free disk space on the blockchain partition
bool offline () const
 get whether the core is running offline
uint32_t get_blockchain_pruning_seed () const
 get the blockchain pruning seed
bool prune_blockchain (uint32_t pruning_seed=0)
 prune the blockchain
bool update_blockchain_pruning ()
 incrementally prunes blockchain
bool check_blockchain_pruning ()
 checks the blockchain pruning if enabled
bool is_within_compiled_block_hash_area (uint64_t height) const
 checks whether a given block height is included in the precompiled block hash area
bool has_block_weights (uint64_t height, uint64_t nblocks) const
 checks whether block weights are known for the given range
void flush_invalid_blocks ()
 flushes the invalid block cache
bool get_txpool_complement (const std::vector< crypto::hash > &hashes, std::vector< cryptonote::blobdata > &txes)
 returns the set of transactions in the txpool which are not in the argument
Public Member Functions inherited from cryptonote::i_core_events
virtual ~i_core_events () noexcept

Static Public Member Functions

static void init_options (boost::program_options::options_description &desc)
 adds command line options to the given options set
static bool check_tx_semantic (const transaction &tx, tx_verification_context &tvc, uint8_t hf_version)
 validates some simple properties of a transaction
static bool check_tx_inputs_keyimages_diff (const transaction &tx)
 verify that each input key image in a transaction is unique
static bool check_tx_inputs_ring_members_diff (const transaction &tx, const uint8_t hf_version)
 verify that each ring uses distinct members
static bool check_tx_inputs_keyimages_domain (const transaction &tx)
 verify that each input key image in a transaction is in the valid domain

Private Types

enum  { UPDATES_DISABLED , UPDATES_NOTIFY , UPDATES_DOWNLOAD , UPDATES_UPDATE }

Private Member Functions

bool add_new_tx (transaction &tx, const crypto::hash &tx_hash, const cryptonote::blobdata &blob, size_t tx_weight, tx_verification_context &tvc, relay_method tx_relay, bool relayed)
bool add_new_tx (transaction &tx, tx_verification_context &tvc, relay_method tx_relay, bool relayed)
 add a new transaction to the transaction pool
bool add_new_block (const block &b, block_verification_context &bvc, pool_supplement &extra_block_txs)
 adds a block to the blockchain
bool load_state_data ()
 load any core state stored on disk
bool update_miner_block_template ()
bool handle_command_line (const boost::program_options::variables_map &vm)
 act on a set of command line options given
bool relay_txpool_transactions ()
 attempts to relay any transactions in the mempool which need it
bool notify_txpool_event (const epee::span< const cryptonote::blobdata > tx_blobs, epee::span< const crypto::hash > tx_hashes, epee::span< const cryptonote::transaction > txs, const std::vector< bool > &just_broadcasted) const
 sends notification of txpool events to subscribers
bool check_updates ()
 checks DNS versions
bool check_disk_space ()
 checks free disk space
bool check_block_rate ()
 checks block rate, and warns if it's too slow
bool recalculate_difficulties ()
 recalculate difficulties after the last difficulty checklpoint to circumvent the annoying 'difficulty drift' bug

Private Attributes

bool m_test_drop_download = true
 whether or not to drop incoming blocks (for testing)
uint64_t m_test_drop_download_height = 0
 height under which to drop incoming blocks, if doing so
tx_memory_pool m_mempool
 transaction pool instance
Blockchain m_blockchain_storage
 Blockchain instance.
i_cryptonote_protocolm_pprotocol
 cryptonote protocol instance
epee::critical_section m_incoming_tx_lock
 incoming transaction lock
miner m_miner
 miner instance
std::string m_config_folder
 folder to look in for configs and other files
cryptonote_protocol_stub m_protocol_stub
 cryptonote protocol stub instance
epee::math_helper::once_a_time_seconds< 60 *60 *12, falsem_store_blockchain_interval
 interval for manual storing of Blockchain, if enabled
epee::math_helper::once_a_time_seconds< 60 *60 *2, truem_fork_moaner
 interval for checking HardFork status
epee::math_helper::once_a_time_seconds< 60 *60 *12, truem_check_updates_interval
 interval for checking for new versions
epee::math_helper::once_a_time_seconds< 60 *10, truem_check_disk_space_interval
 interval for checking for disk space
epee::math_helper::once_a_time_seconds< 90, falsem_block_rate_interval
 interval for checking block rate
epee::math_helper::once_a_time_seconds< 60 *60 *5, truem_blockchain_pruning_interval
 interval for incremental blockchain pruning
epee::math_helper::once_a_time_seconds< 60 *60 *24 *7, falsem_diff_recalc_interval
 interval for recalculating difficulties
std::atomic< bool > m_starter_message_showed
 has the "daemon will sync now" message been shown?
uint64_t m_target_blockchain_height
 blockchain height target
network_type m_nettype
 which network are we on?
std::atomic< bool > m_update_available
std::string m_checkpoints_path
 path to json checkpoints file
time_t m_last_dns_checkpoints_update
 time when dns checkpoints were last updated
time_t m_last_json_checkpoints_update
 time when json checkpoints were last updated
std::atomic_flag m_checkpoints_updating
 set if checkpoints are currently updating to avoid multiple threads attempting to update at once
bool m_disable_dns_checkpoints
size_t block_sync_size
time_t start_time
enum cryptonote::core:: { ... }  check_updates_level
tools::download_async_handle m_update_download
size_t m_last_update_length
boost::mutex m_update_mutex
bool m_offline
std::shared_ptr< tools::Notifym_block_rate_notify

Additional Inherited Members

Protected Member Functions inherited from cryptonote::i_miner_handler
 ~i_miner_handler ()

Detailed Description

handles core cryptonote functionality

This class coordinates cryptonote functionality including, but not limited to, communication among the Blockchain, the transaction pool, any miners, and the network.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
UPDATES_DISABLED 
UPDATES_NOTIFY 
UPDATES_DOWNLOAD 
UPDATES_UPDATE 

Constructor & Destructor Documentation

◆ core()

cryptonote::core::core ( i_cryptonote_protocol * pprotocol)

constructor

sets member variables into a usable state

Parameters
pprotocolpre-constructed protocol object to store and use

Member Function Documentation

◆ add_new_block()

bool cryptonote::core::add_new_block ( const block & b,
block_verification_context & bvc,
pool_supplement & extra_block_txs )
private

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
extra_block_txstxs belonging to this block that may not be in the mempool
Returns
true on successful addition to the blockchain, else false
Note
see Blockchain::add_new_block

◆ add_new_tx() [1/2]

bool cryptonote::core::add_new_tx ( transaction & tx,
const crypto::hash & tx_hash,
const cryptonote::blobdata & blob,
size_t tx_weight,
tx_verification_context & tvc,
relay_method tx_relay,
bool relayed )
private

Parameters
tx_hashthe transaction's hash
blobthe transaction as a blob
tx_weightthe weight of the transaction
tx_relayhow the transaction was received
relayedwhether or not the transaction was relayed to us

◆ add_new_tx() [2/2]

bool cryptonote::core::add_new_tx ( transaction & tx,
tx_verification_context & tvc,
relay_method tx_relay,
bool relayed )
private

add a new transaction to the transaction pool

Adds a new transaction to the transaction pool.

Parameters
txthe transaction to add
tvcreturn-by-reference metadata about the transaction's verification process
tx_relayhow the transaction was received
relayedwhether or not the transaction was relayed to us
Returns
true if the transaction is already in the transaction pool, is already in a block on the Blockchain, or is successfully added to the transaction pool

◆ are_key_images_spent()

bool cryptonote::core::are_key_images_spent ( const std::vector< crypto::key_image > & key_im,
std::vector< bool > & spent ) const

check if multiple key images are spent

plural version of is_key_image_spent()

Parameters
key_imlist of key images to check
spentreturn-by-reference result for each image checked
Returns
true

◆ are_key_images_spent_in_pool()

bool cryptonote::core::are_key_images_spent_in_pool ( const std::vector< crypto::key_image > & key_im,
std::vector< bool > & spent ) const

check if multiple key images are spent in the transaction pool

Parameters
key_imlist of key images to check
spentreturn-by-reference result for each image checked
Returns
true

◆ check_block_rate()

bool cryptonote::core::check_block_rate ( )
private

checks block rate, and warns if it's too slow

Returns
true on success, false otherwise

◆ check_blockchain_pruning()

bool cryptonote::core::check_blockchain_pruning ( )

checks the blockchain pruning if enabled

Returns
true on success, false otherwise

◆ check_disk_space()

bool cryptonote::core::check_disk_space ( )
private

checks free disk space

Returns
true on success, false otherwise

◆ check_incoming_block_size()

bool cryptonote::core::check_incoming_block_size ( const blobdata & block_blob) const

check the size of a block against the current maximum

Parameters
block_blobthe block to check
Returns
whether or not the block is too big

◆ check_tx_inputs_keyimages_diff()

bool cryptonote::core::check_tx_inputs_keyimages_diff ( const transaction & tx)
static

verify that each input key image in a transaction is unique

Parameters
txthe transaction to check
Returns
false if any key image is repeated, otherwise true

◆ check_tx_inputs_keyimages_domain()

bool cryptonote::core::check_tx_inputs_keyimages_domain ( const transaction & tx)
static

verify that each input key image in a transaction is in the valid domain

Parameters
txthe transaction to check
Returns
false if any key image is not in the valid domain, otherwise true

◆ check_tx_inputs_ring_members_diff()

bool cryptonote::core::check_tx_inputs_ring_members_diff ( const transaction & tx,
const uint8_t hf_version )
static

verify that each ring uses distinct members

Parameters
txthe transaction to check
hf_versionthe hard fork version rules to use
Returns
false if any ring uses duplicate members, true otherwise

◆ check_tx_semantic()

bool cryptonote::core::check_tx_semantic ( const transaction & tx,
tx_verification_context & tvc,
uint8_t hf_version )
static

validates some simple properties of a transaction

Currently checks: tx has inputs, tx inputs all of supported type(s), tx outputs valid (type, key, amount), input and output total amounts don't overflow, output amount <= input amount, tx not too large, each input has a different key image.

Parameters
txthe transaction to check
tvctx verification context where extra fail flags are stored
hf_versionhard fork version
Returns
true if all the checks pass, otherwise false

◆ check_updates()

bool cryptonote::core::check_updates ( )
private

checks DNS versions

Returns
true on success, false otherwise

◆ cleanup_handle_incoming_blocks()

bool cryptonote::core::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
Note
see Blockchain::cleanup_handle_incoming_blocks

◆ deinit()

bool cryptonote::core::deinit ( )

performs safe shutdown steps for core and core components

Uninitializes the miner instance, transaction pool, and Blockchain

Returns
true

◆ disable_dns_checkpoints()

void cryptonote::core::disable_dns_checkpoints ( bool disable = true)
inline

set whether or not to enable or disable DNS checkpoints

Parameters
disblewhether to disable DNS checkpoints

◆ find_blockchain_supplement() [1/2]

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

Note
see Blockchain::find_blockchain_supplement(const std::list<crypto::hash>&, NOTIFY_RESPONSE_CHAIN_ENTRY::request&) const

◆ find_blockchain_supplement() [2/2]

bool cryptonote::core::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_block_count,
size_t max_tx_count ) const

Note
see Blockchain::find_blockchain_supplement(const uint64_t, const std::list<crypto::hash>&, std::vector<std::pair<cryptonote::blobdata, std::vector<transaction> > >&, uint64_t&, uint64_t&, size_t) const

◆ flush_invalid_blocks()

void cryptonote::core::flush_invalid_blocks ( )

flushes the invalid block cache

◆ get_alternative_blocks()

bool cryptonote::core::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
Note
see Blockchain::get_alternative_blocks(std::vector<block>&) const

◆ get_alternative_blocks_count()

size_t cryptonote::core::get_alternative_blocks_count ( ) const

returns the number of alternative blocks stored

Returns
the number of alternative blocks stored
Note
see Blockchain::get_alternative_blocks_count() const

◆ get_block_by_hash()

bool cryptonote::core::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
Note
see Blockchain::get_block_by_hash

◆ get_block_cumulative_difficulty()

difficulty_type cryptonote::core::get_block_cumulative_difficulty ( uint64_t height) const

Note
see Blockchain::get_block_cumulative_difficulty

◆ get_block_id_by_height()

crypto::hash cryptonote::core::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
Note
see Blockchain::get_block_id_by_height

◆ get_block_sync_size()

size_t cryptonote::core::get_block_sync_size ( uint64_t height) const

get the number of blocks to sync in one go

Returns
the number of blocks to sync in one go

◆ get_block_template() [1/2]

bool cryptonote::core::get_block_template ( block & b,
const account_public_address & adr,
difficulty_type & diffic,
uint64_t & height,
uint64_t & expected_reward,
const blobdata & ex_nonce,
uint64_t & seed_height,
crypto::hash & seed_hash )
overridevirtual

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
Note
see Blockchain::create_block_template

Implements cryptonote::i_miner_handler.

◆ get_block_template() [2/2]

bool cryptonote::core::get_block_template ( block & b,
const crypto::hash * prev_block,
const account_public_address & adr,
difficulty_type & diffic,
uint64_t & height,
uint64_t & expected_reward,
const blobdata & ex_nonce,
uint64_t & seed_height,
crypto::hash & seed_hash )
virtual

◆ get_blockchain_pruning_seed()

uint32_t cryptonote::core::get_blockchain_pruning_seed ( ) const

get the blockchain pruning seed

Returns
the blockchain pruning seed

◆ get_blockchain_storage() [1/2]

Blockchain & cryptonote::core::get_blockchain_storage ( )
inline

gets the Blockchain instance

Returns
a reference to the Blockchain instance

◆ get_blockchain_storage() [2/2]

const Blockchain & cryptonote::core::get_blockchain_storage ( ) const
inline

gets the Blockchain instance (const)

Returns
a const reference to the Blockchain instance

◆ get_blockchain_top()

void cryptonote::core::get_blockchain_top ( uint64_t & height,
crypto::hash & top_id ) const

get the hash and height of the most recent block

Parameters
heightreturn-by-reference height of the block
top_idreturn-by-reference hash of the block

◆ get_blockchain_total_transactions()

size_t cryptonote::core::get_blockchain_total_transactions ( ) const

gets the total number of transactions on the main chain

Returns
the number of transactions on the main chain
Note
see Blockchain::get_total_transactions

◆ get_blocks() [1/4]

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

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
Note
see Blockchain::get_blocks(const t_ids_container&, t_blocks_container&, t_missed_container&) const

◆ get_blocks() [2/4]

bool cryptonote::core::get_blocks ( uint64_t start_offset,
size_t count,
std::vector< 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
Note
see Blockchain::get_blocks(uint64_t, size_t, std::vector<std::pair<cryptonote::blobdata,block>>&) const

◆ get_blocks() [3/4]

bool cryptonote::core::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
Note
see Blockchain::get_blocks(uint64_t, size_t, std::vector<std::pair<cryptonote::blobdata,block>>&) const

◆ get_blocks() [4/4]

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

Note
see Blockchain::get_blocks(uint64_t, size_t, std::vector<std::pair<cryptonote::blobdata,block>>&, std::vector<transaction>&) const

◆ get_checkpoints()

const checkpoints & cryptonote::core::get_checkpoints ( ) const

get a set of blockchain checkpoint hashes

Returns
set of blockchain checkpoint hashes
Note
see Blockchain::get_checkpoints()

◆ get_coinbase_tx_sum()

std::pair< boost::multiprecision::uint128_t, boost::multiprecision::uint128_t > cryptonote::core::get_coinbase_tx_sum ( const uint64_t start_offset,
const size_t count )

get the sum of coinbase tx amounts between blocks

Returns
the number of blocks to sync in one go

◆ get_current_blockchain_height()

uint64_t cryptonote::core::get_current_blockchain_height ( ) const
finalvirtual

get the current height of the blockchain

Returns
the height
Note
see Blockchain::get_current_blockchain_height()

Implements cryptonote::i_core_events.

◆ get_earliest_ideal_height_for_version()

uint64_t cryptonote::core::get_earliest_ideal_height_for_version ( uint8_t version) const

return the earliest block a given version may activate

Returns
what it says above

◆ get_free_space()

uint64_t cryptonote::core::get_free_space ( ) const

get free disk space on the blockchain partition

Returns
free space in bytes

◆ get_hard_fork_version()

uint8_t cryptonote::core::get_hard_fork_version ( uint64_t height) const

return the hard fork version for a given block height

Returns
what it says above

◆ get_ideal_hard_fork_version() [1/2]

uint8_t cryptonote::core::get_ideal_hard_fork_version ( ) const

returns the newest hardfork version known to the blockchain

Returns
the version

◆ get_ideal_hard_fork_version() [2/2]

uint8_t cryptonote::core::get_ideal_hard_fork_version ( uint64_t height) const

return the ideal hard fork version for a given block height

Returns
what it says above

◆ get_miner() [1/2]

miner & cryptonote::core::get_miner ( )
inline

gets the miner instance

Returns
a reference to the miner instance

◆ get_miner() [2/2]

const miner & cryptonote::core::get_miner ( ) const
inline

gets the miner instance (const)

Returns
a const reference to the miner instance

◆ get_miner_data()

bool cryptonote::core::get_miner_data ( uint8_t & major_version,
uint64_t & height,
crypto::hash & prev_id,
crypto::hash & seed_hash,
difficulty_type & difficulty,
uint64_t & median_weight,
uint64_t & already_generated_coins,
std::vector< tx_block_template_backlog_entry > & tx_backlog )

gets data required to create a block template and start mining on it

Parameters
major_versioncurrent hardfork version
heightcurrent blockchain height
prev_idhash of the top block
seed_hashseed hash used for RandomX initialization
difficultycurrent mining difficulty
median_weightcurrent median block weight
already_generated_coinscurrent emission
tx_backlogtransactions in mempool ready to be mined
Returns
true if block template filled in successfully, else false
Note
see Blockchain::get_miner_data

◆ get_nettype()

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

get the network type we're on

Returns
which network are we on?

◆ get_output_distribution()

bool cryptonote::core::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 per block distribution of outputs of a given amount

◆ get_outs()

bool cryptonote::core::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
Note
see Blockchain::get_outs

◆ get_pool_for_rpc()

bool cryptonote::core::get_pool_for_rpc ( std::vector< cryptonote::rpc::tx_in_pool > & tx_infos,
cryptonote::rpc::key_images_with_tx_hashes & key_image_infos ) const

get information about all transactions and key images in the pool

see documentation on tx_in_pool and key_images_with_tx_hashes for more details

Parameters
tx_infos[out] the transactions' information
key_image_infos[out] the spent key images' information
Returns
true
Note
see tx_memory_pool::get_pool_for_rpc

◆ get_pool_info()

bool cryptonote::core::get_pool_info ( time_t start_time,
bool include_sensitive_txes,
size_t max_tx_count,
std::vector< std::pair< crypto::hash, tx_memory_pool::tx_details > > & added_txs,
std::vector< crypto::hash > & remaining_added_txids,
std::vector< crypto::hash > & removed_txs,
bool & incremental ) const

get info necessary for update of pool-related info in a wallet, preferably incremental

Returns
true on success, false on error
Parameters
include_sensitive_txesinclude private transactions
max_tx_countmax allowed added_txs in response
Note
see tx_memory_pool::get_pool_info

◆ get_pool_transaction()

bool cryptonote::core::get_pool_transaction ( const crypto::hash & id,
cryptonote::blobdata & tx,
relay_category tx_category ) const

get a specific transaction from the pool

Parameters
hthe hash of the transaction to get
txreturn-by-reference the transaction blob requested
tx_relaylast relay method us
Returns
true if the transaction is found, otherwise false
Note
see tx_memory_pool::get_transaction

◆ get_pool_transaction_hashes()

bool cryptonote::core::get_pool_transaction_hashes ( std::vector< crypto::hash > & txs,
bool include_sensitive_txes = false ) const

get a list of all transactions in the pool

Parameters
txsreturn-by-reference the list of transactions
include_sensitivereturn stempool, anonymity-pool, and unrelayed txes
include_sensitive_txesinclude private transactions
Note
see tx_memory_pool::get_transactions

◆ get_pool_transaction_stats()

bool cryptonote::core::get_pool_transaction_stats ( struct txpool_stats & stats,
bool include_sensitive_txes = false ) const

get a list of all transactions in the pool

Parameters
txsreturn-by-reference the list of transactions
include_sensitivereturn stempool, anonymity-pool, and unrelayed txes
include_sensitive_txesinclude private transactions
Note
see tx_memory_pool::get_transactions

◆ get_pool_transactions()

bool cryptonote::core::get_pool_transactions ( std::vector< transaction > & txs,
bool include_sensitive_txes = false ) const

get a list of all transactions in the pool

Parameters
txsreturn-by-reference the list of transactions
include_sensitivereturn stempool, anonymity-pool, and unrelayed txes
include_sensitive_txesinclude private transactions
Note
see tx_memory_pool::get_transactions

◆ get_pool_transactions_and_spent_keys_info()

bool cryptonote::core::get_pool_transactions_and_spent_keys_info ( std::vector< tx_info > & tx_infos,
std::vector< spent_key_image_info > & key_image_infos,
bool include_sensitive_txes = false ) const

Parameters
include_sensitive_txesinclude private transactions
Note
see tx_memory_pool::get_pool_transactions_and_spent_keys_info

◆ get_pool_transactions_count()

size_t cryptonote::core::get_pool_transactions_count ( bool include_sensitive_txes = false) const

get the total number of transactions in the pool

Returns
the number of transactions in the pool
Parameters
include_sensitive_txesinclude private transactions
Note
see tx_memory_pool::get_transactions_count

◆ get_pool_transactions_info()

bool cryptonote::core::get_pool_transactions_info ( const std::vector< crypto::hash > & txids,
std::vector< std::pair< crypto::hash, tx_memory_pool::tx_details > > & txs,
bool include_sensitive_txes = false ) const

Parameters
include_sensitive_txesinclude private transactions
Note
see tx_memory_pool::get_pool_transactions_info

◆ get_protocol()

i_cryptonote_protocol * cryptonote::core::get_protocol ( )
inline

get the cryptonote protocol instance

Returns
the instance

◆ get_short_chain_history()

bool cryptonote::core::get_short_chain_history ( std::list< crypto::hash > & ids,
uint64_t & current_height ) 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
current_heightthe current blockchain height, return-by-reference
Returns
true
Note
see Blockchain::get_short_chain_history

◆ get_split_transactions_blobs()

bool cryptonote::core::get_split_transactions_blobs ( const std::vector< crypto::hash > & txs_ids,
std::vector< std::tuple< crypto::hash, cryptonote::blobdata, crypto::hash, cryptonote::blobdata > > & txs,
std::vector< crypto::hash > & missed_txs ) const

◆ get_start_time()

std::time_t cryptonote::core::get_start_time ( ) const

gets start_time

◆ get_tail_id()

crypto::hash cryptonote::core::get_tail_id ( ) const

get the hash of the most recent block on the blockchain

Returns
the hash
Note
see Blockchain::get_tail_id

◆ get_target_blockchain_height()

uint64_t cryptonote::core::get_target_blockchain_height ( ) const

gets the target blockchain height

Parameters
target_blockchain_heightthe target height

◆ get_test_drop_download()

bool cryptonote::core::get_test_drop_download ( ) const

gets whether or not to drop blocks (for testing)

Returns
whether or not to drop blocks

◆ get_test_drop_download_height()

bool cryptonote::core::get_test_drop_download_height ( ) const

gets whether or not to drop blocks

If the current blockchain height <= our block drop threshold and test drop blocks is set, return true

Returns
see above

◆ get_transactions() [1/2]

bool cryptonote::core::get_transactions ( const std::vector< crypto::hash > & txs_ids,
std::vector< cryptonote::blobdata > & txs,
std::vector< crypto::hash > & missed_txs,
bool pruned = false ) const

◆ get_transactions() [2/2]

bool cryptonote::core::get_transactions ( const std::vector< crypto::hash > & txs_ids,
std::vector< transaction > & txs,
std::vector< crypto::hash > & missed_txs,
bool pruned = false ) const

◆ get_tx_outputs_gindexs() [1/2]

bool cryptonote::core::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 cryptonote::core::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
Note
see Blockchain::get_tx_outputs_gindexs

◆ get_txpool_backlog()

bool cryptonote::core::get_txpool_backlog ( std::vector< tx_backlog_entry > & backlog,
bool include_sensitive_txes = false ) const

Parameters
include_sensitive_txesinclude private transactions
Note
see tx_memory_pool::get_txpool_backlog

◆ get_txpool_complement()

bool cryptonote::core::get_txpool_complement ( const std::vector< crypto::hash > & hashes,
std::vector< cryptonote::blobdata > & txes )

returns the set of transactions in the txpool which are not in the argument

Parameters
hasheshashes of transactions to exclude from the result
Returns
true iff success, false otherwise

◆ graceful_exit()

void cryptonote::core::graceful_exit ( )

tells the daemon to wind down operations and stop running

Currently this function raises SIGTERM, allowing the installed signal handlers to do the actual stopping.

◆ handle_block_found()

bool cryptonote::core::handle_block_found ( block & b,
block_verification_context & bvc )
overridevirtual

stores and relays a block found by a miner

Updates the miner's target block, attempts to store the found block in Blockchain, and – on success – relays that block to the network.

Parameters
bthe block found
bvcreturns the block verification flags
Returns
true if the block was added to the main chain, otherwise false

Implements cryptonote::i_miner_handler.

◆ handle_command_line()

bool cryptonote::core::handle_command_line ( const boost::program_options::variables_map & vm)
private

act on a set of command line options given

Parameters
vmthe command line options
Returns
true

◆ handle_get_objects()

bool cryptonote::core::handle_get_objects ( NOTIFY_REQUEST_GET_OBJECTS::request & arg,
NOTIFY_RESPONSE_GET_OBJECTS::request & rsp,
cryptonote_connection_context & context )

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
Note
see Blockchain::handle_get_objects()
Parameters
contextconnection context associated with the request

◆ handle_incoming_block() [1/2]

bool cryptonote::core::handle_incoming_block ( const blobdata & block_blob,
const block * b,
block_verification_context & bvc,
bool update_miner_blocktemplate = true )

handles an incoming block as part of a batch

periodic update to checkpoints is triggered here Attempts to add the block to the Blockchain and, on success, optionally updates the miner's block template.

Prerequisite: There must be an active write transaction for the blockchain storage on this thread. Typically, this is done by calling prepare_handle_incoming_blocks() on this thread before calls to handle_incoming_block(). Then, after calls to handle_incoming_block(), a call to cleanup_handle_incoming_blocks() is made on this thread to either abort or commit the write transaction.

Parameters
block_blobthe block to be added
blockthe block to be added, or NULL
bvcreturn-by-reference metadata context about the block's validity
extra_block_txstxs belonging to this block that may not be in the mempool
update_miner_blocktemplatewhether or not to update the miner's block template
Returns
false if loading new checkpoints fails, or the block is not added, otherwise true

◆ handle_incoming_block() [2/2]

bool cryptonote::core::handle_incoming_block ( const blobdata & block_blob,
const block * b,
block_verification_context & bvc,
pool_supplement & extra_block_txs,
bool update_miner_blocktemplate = true )

◆ handle_incoming_tx()

bool cryptonote::core::handle_incoming_tx ( const blobdata & tx_blob,
tx_verification_context & tvc,
relay_method tx_relay,
bool relayed )

handles an incoming transaction

Parses an incoming transaction and, if nothing is obviously wrong, passes it along to the transaction pool

Parameters
tx_blobthe tx to handle
tvcmetadata about the transaction's validity
tx_relayhow the transaction was received
relayedwhether or not the transaction was relayed to us
Returns
true if the transaction was accepted, false otherwise

◆ handle_single_incoming_block()

bool cryptonote::core::handle_single_incoming_block ( const blobdata & block_blob,
const block * b,
block_verification_context & bvc,
pool_supplement & extra_block_txs,
bool update_miner_blocktemplate = true )

handles a single incoming block

periodic update to checkpoints is triggered here Attempts to add the block to the Blockchain and, on success, optionally updates the miner's block template.

Unlike handle_incoming_block(), a write transaction is created in this method, which means the caller doesn't have to call prepare_handle_incoming_blocks() nor cleanup_handle_incoming_blocks() surrounding this call.

Parameters
block_blobthe block to be added
blockthe block to be added, or NULL
bvcreturn-by-reference metadata context about the block's validity
extra_block_txstxs belonging to this block that may not be in the mempool
update_miner_blocktemplatewhether or not to update the miner's block template
Returns
false if loading new checkpoints fails, or the block is not added, otherwise true

◆ has_block_weights()

bool cryptonote::core::has_block_weights ( uint64_t height,
uint64_t nblocks ) const

checks whether block weights are known for the given range

◆ have_block()

bool cryptonote::core::have_block ( const crypto::hash & id,
int * where = NULL ) const

◆ have_block_unlocked()

bool cryptonote::core::have_block_unlocked ( const crypto::hash & id,
int * where = NULL ) const

◆ init()

bool cryptonote::core::init ( const boost::program_options::variables_map & vm,
const test_options * test_options = NULL,
const GetCheckpointsCallback & get_checkpoints = nullptr,
bool allow_dns = true )

initializes the core as needed

This function initializes the transaction pool, the Blockchain, and a miner instance with parameters given on the command line (or defaults)

Parameters
vmcommand line parameters
test_optionsconfiguration options for testing
get_checkpointsif set, will be called to get checkpoints data, must return checkpoints data pointer and size or nullptr if there ain't any checkpoints for specific network type
allow_dnswhether or not to allow DNS requests
Returns
false if one of the init steps fails, otherwise true

◆ init_options()

void cryptonote::core::init_options ( boost::program_options::options_description & desc)
static

adds command line options to the given options set

As of now, there are no command line options specific to core, so this function simply returns.

Parameters
descreturn-by-reference the command line options set to add to

◆ is_key_image_spent()

bool cryptonote::core::is_key_image_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
Note
see Blockchain::have_tx_keyimg_as_spent

◆ is_synchronized()

bool cryptonote::core::is_synchronized ( ) const
finalvirtual

gets the core synchronization status

Returns
core synchronization status

Implements cryptonote::i_core_events.

◆ is_update_available()

bool cryptonote::core::is_update_available ( ) const
inline

check whether an update is known to be available or not

This does not actually trigger a check, but returns the result of the last check

Returns
whether an update is known to be available or not

◆ is_within_compiled_block_hash_area()

bool cryptonote::core::is_within_compiled_block_hash_area ( uint64_t height) const

checks whether a given block height is included in the precompiled block hash area

Parameters
heightthe height to check for

◆ load_state_data()

bool cryptonote::core::load_state_data ( )
private

load any core state stored on disk

currently does nothing, but may have state to load in the future.

Returns
true

◆ notify_txpool_event()

bool cryptonote::core::notify_txpool_event ( const epee::span< const cryptonote::blobdata > tx_blobs,
epee::span< const crypto::hash > tx_hashes,
epee::span< const cryptonote::transaction > txs,
const std::vector< bool > & just_broadcasted ) const
private

sends notification of txpool events to subscribers

Returns
true on success, false otherwise

◆ offline()

bool cryptonote::core::offline ( ) const
inline

get whether the core is running offline

Returns
whether the core is running offline

◆ on_idle()

bool cryptonote::core::on_idle ( )

calls various idle routines

Note
see miner::on_idle and tx_memory_pool::on_idle
Returns
true

◆ on_synchronized()

void cryptonote::core::on_synchronized ( )

◆ on_transactions_relayed()

void cryptonote::core::on_transactions_relayed ( epee::span< const cryptonote::blobdata > tx_blobs,
relay_method tx_relay )
finalvirtual

called when a transaction is relayed.

Note
Should only be invoked from levin_notify.

Implements cryptonote::i_core_events.

◆ pause_mine()

void cryptonote::core::pause_mine ( )

Note
see miner::pause

◆ pool_has_tx()

bool cryptonote::core::pool_has_tx ( const crypto::hash & txid) const

checks if the pool has a transaction with the given hash

Parameters
idthe hash to look for
tx_categorya filter for txes
Returns
true if the transaction is in the pool and meets tx_category requirements
Note
see tx_memory_pool::have_tx

◆ prepare_handle_incoming_blocks()

bool cryptonote::core::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
Note
see Blockchain::prepare_handle_incoming_blocks

◆ prevalidate_block_hashes()

uint64_t cryptonote::core::prevalidate_block_hashes ( uint64_t height,
const std::vector< crypto::hash > & hashes,
const std::vector< uint64_t > & weights )

check a set of hashes against the precompiled hash set

Returns
number of usable blocks

◆ print_pool()

std::string cryptonote::core::print_pool ( bool short_format) const

get a string containing human-readable pool information

Parameters
short_formatwhether to use a shortened format for the info
Returns
the string
Note
see tx_memory_pool::print_pool

◆ prune_blockchain()

bool cryptonote::core::prune_blockchain ( uint32_t pruning_seed = 0)

prune the blockchain

Parameters
pruning_seedthe seed to use to prune the chain (0 for default, highly recommended)
Returns
true iff success

◆ recalculate_difficulties()

bool cryptonote::core::recalculate_difficulties ( )
private

recalculate difficulties after the last difficulty checklpoint to circumvent the annoying 'difficulty drift' bug

Returns
true

◆ relay_txpool_transactions()

bool cryptonote::core::relay_txpool_transactions ( )
private

attempts to relay any transactions in the mempool which need it

Returns
true

◆ resume_mine()

void cryptonote::core::resume_mine ( )

Note
see miner::resume

◆ safesyncmode()

void cryptonote::core::safesyncmode ( const bool onoff)

Put DB in safe sync mode.

2note see Blockchain::safesyncmode

◆ set_checkpoints()

void cryptonote::core::set_checkpoints ( checkpoints && chk_pts)

assign a set of blockchain checkpoint hashes

Parameters
chk_ptsthe set of checkpoints to assign
Note
see Blockchain::set_checkpoints()

◆ set_checkpoints_file_path()

void cryptonote::core::set_checkpoints_file_path ( const std::string & path)

set the file path to read from when loading checkpoints

Parameters
paththe path to set ours as

◆ set_cryptonote_protocol()

void cryptonote::core::set_cryptonote_protocol ( i_cryptonote_protocol * pprotocol)

set the pointer to the cryptonote protocol object to use

Parameters
pprotocolthe pointer to set ours as

◆ set_enforce_dns_checkpoints()

void cryptonote::core::set_enforce_dns_checkpoints ( bool enforce_dns)

set whether or not we enforce DNS checkpoints

Parameters
enforce_dnsenforce DNS checkpoints or not

◆ set_genesis_block()

bool cryptonote::core::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
Note
see Blockchain::reset_and_set_genesis_block

◆ set_target_blockchain_height()

void cryptonote::core::set_target_blockchain_height ( uint64_t target_blockchain_height)

sets the target blockchain height

Parameters
target_blockchain_heightthe height to set

◆ stop()

void cryptonote::core::stop ( )

stops the daemon running

Note
see graceful_exit()

◆ test_drop_download()

void cryptonote::core::test_drop_download ( )

sets to drop blocks downloaded (for testing)

◆ test_drop_download_height()

void cryptonote::core::test_drop_download_height ( uint64_t height)

sets to drop blocks downloaded below a certain height

Parameters
heightheight below which to drop blocks

◆ update_blockchain_pruning()

bool cryptonote::core::update_blockchain_pruning ( )

incrementally prunes blockchain

Returns
true on success, false otherwise

◆ update_checkpoints()

bool cryptonote::core::update_checkpoints ( const bool skip_dns = false)

tells the Blockchain to update its checkpoints

This function will check if enough time has passed since the last time checkpoints were updated and tell the Blockchain to update its checkpoints if it is time. If updating checkpoints fails, the daemon is told to shut down.

Note
see Blockchain::update_checkpoints()

◆ update_miner_block_template()

bool cryptonote::core::update_miner_block_template ( )
private

Note
see miner::on_block_chain_update
Returns
true

Member Data Documentation

◆ block_sync_size

size_t cryptonote::core::block_sync_size
private

◆ []

enum { ... } cryptonote::core::check_updates_level

◆ m_block_rate_interval

epee::math_helper::once_a_time_seconds<90, false> cryptonote::core::m_block_rate_interval
private

interval for checking block rate

◆ m_block_rate_notify

std::shared_ptr<tools::Notify> cryptonote::core::m_block_rate_notify
private

◆ m_blockchain_pruning_interval

epee::math_helper::once_a_time_seconds<60*60*5, true> cryptonote::core::m_blockchain_pruning_interval
private

interval for incremental blockchain pruning

◆ m_blockchain_storage

Blockchain cryptonote::core::m_blockchain_storage
private

Blockchain instance.

◆ m_check_disk_space_interval

epee::math_helper::once_a_time_seconds<60*10, true> cryptonote::core::m_check_disk_space_interval
private

interval for checking for disk space

◆ m_check_updates_interval

epee::math_helper::once_a_time_seconds<60*60*12, true> cryptonote::core::m_check_updates_interval
private

interval for checking for new versions

◆ m_checkpoints_path

std::string cryptonote::core::m_checkpoints_path
private

path to json checkpoints file

◆ m_checkpoints_updating

std::atomic_flag cryptonote::core::m_checkpoints_updating
private

set if checkpoints are currently updating to avoid multiple threads attempting to update at once

◆ m_config_folder

std::string cryptonote::core::m_config_folder
private

folder to look in for configs and other files

◆ m_diff_recalc_interval

epee::math_helper::once_a_time_seconds<60*60*24*7, false> cryptonote::core::m_diff_recalc_interval
private

interval for recalculating difficulties

◆ m_disable_dns_checkpoints

bool cryptonote::core::m_disable_dns_checkpoints
private

◆ m_fork_moaner

epee::math_helper::once_a_time_seconds<60*60*2, true> cryptonote::core::m_fork_moaner
private

interval for checking HardFork status

◆ m_incoming_tx_lock

epee::critical_section cryptonote::core::m_incoming_tx_lock
private

incoming transaction lock

◆ m_last_dns_checkpoints_update

time_t cryptonote::core::m_last_dns_checkpoints_update
private

time when dns checkpoints were last updated

◆ m_last_json_checkpoints_update

time_t cryptonote::core::m_last_json_checkpoints_update
private

time when json checkpoints were last updated

◆ m_last_update_length

size_t cryptonote::core::m_last_update_length
private

◆ m_mempool

tx_memory_pool cryptonote::core::m_mempool
private

transaction pool instance

◆ m_miner

miner cryptonote::core::m_miner
private

miner instance

◆ m_nettype

network_type cryptonote::core::m_nettype
private

which network are we on?

◆ m_offline

bool cryptonote::core::m_offline
private

◆ m_pprotocol

i_cryptonote_protocol* cryptonote::core::m_pprotocol
private

cryptonote protocol instance

◆ m_protocol_stub

cryptonote_protocol_stub cryptonote::core::m_protocol_stub
private

cryptonote protocol stub instance

◆ m_starter_message_showed

std::atomic<bool> cryptonote::core::m_starter_message_showed
private

has the "daemon will sync now" message been shown?

◆ m_store_blockchain_interval

epee::math_helper::once_a_time_seconds<60*60*12, false> cryptonote::core::m_store_blockchain_interval
private

interval for manual storing of Blockchain, if enabled

◆ m_target_blockchain_height

uint64_t cryptonote::core::m_target_blockchain_height
private

blockchain height target

◆ m_test_drop_download

bool cryptonote::core::m_test_drop_download = true
private

whether or not to drop incoming blocks (for testing)

◆ m_test_drop_download_height

uint64_t cryptonote::core::m_test_drop_download_height = 0
private

height under which to drop incoming blocks, if doing so

◆ m_update_available

std::atomic<bool> cryptonote::core::m_update_available
private

◆ m_update_download

tools::download_async_handle cryptonote::core::m_update_download
private

◆ m_update_mutex

boost::mutex cryptonote::core::m_update_mutex
private

◆ start_time

time_t cryptonote::core::start_time
private

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