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

handles core cryptonote functionality More...

#include <cryptonote_core.h>

Inheritance diagram for cryptonote::core:
Inheritance graph
[legend]
Collaboration diagram for cryptonote::core:
Collaboration graph
[legend]

Classes

struct  tx_verification_batch_info
 

Public Member Functions

 core (i_cryptonote_protocol *pprotocol)
 constructor More...
 
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 More...
 
bool on_idle ()
 calls various idle routines More...
 
bool handle_incoming_tx (const blobdata &tx_blob, tx_verification_context &tvc, bool keeped_by_block, bool relayed, bool do_not_relay)
 handles an incoming transaction More...
 
bool handle_incoming_txs (const std::vector< blobdata > &tx_blobs, std::vector< tx_verification_context > &tvc, bool keeped_by_block, bool relayed, bool do_not_relay)
 handles a list of incoming transactions More...
 
bool handle_incoming_block (const blobdata &block_blob, const block *b, block_verification_context &bvc, bool update_miner_blocktemplate=true)
 handles an incoming block 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 check_incoming_block_size (const blobdata &block_blob) const
 check the size of a block against the current maximum More...
 
i_cryptonote_protocolget_protocol ()
 get the cryptonote protocol instance More...
 
virtual bool handle_block_found (block &b, block_verification_context &bvc)
 stores and relays a block found by a miner More...
 
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)
 creates a new block to mine against More...
 
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)
 
virtual void on_transaction_relayed (const cryptonote::blobdata &tx)
 called when a transaction is relayed More...
 
minerget_miner ()
 gets the miner instance More...
 
const minerget_miner () const
 gets the miner instance (const) More...
 
bool init (const boost::program_options::variables_map &vm, const test_options *test_options=NULL, const GetCheckpointsCallback &get_checkpoints=nullptr)
 initializes the core as needed More...
 
bool set_genesis_block (const block &b)
 clears the blockchain and starts a new one More...
 
bool deinit ()
 performs safe shutdown steps for core and core components More...
 
void test_drop_download ()
 sets to drop blocks downloaded (for testing) More...
 
void test_drop_download_height (uint64_t height)
 sets to drop blocks downloaded below a certain height More...
 
bool get_test_drop_download () const
 gets whether or not to drop blocks (for testing) More...
 
bool get_test_drop_download_height () const
 gets whether or not to drop blocks More...
 
uint64_t get_current_blockchain_height () const
 get the current height of the blockchain More...
 
void get_blockchain_top (uint64_t &height, crypto::hash &top_id) const
 get the hash and height of the most recent block 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
 
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_blocks (uint64_t start_offset, size_t count, std::vector< block > &blocks) const
 get blocks from blocks based on start height and count 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...
 
crypto::hash get_block_id_by_height (uint64_t height) const
 gets a block's hash given a height More...
 
bool get_transactions (const std::vector< crypto::hash > &txs_ids, std::vector< cryptonote::blobdata > &txs, std::vector< crypto::hash > &missed_txs) 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) const
 
bool get_block_by_hash (const crypto::hash &h, block &blk, bool *orphan=NULL) const
 gets the block with a given hash 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...
 
void set_cryptonote_protocol (i_cryptonote_protocol *pprotocol)
 set the pointer to the cryptonote protocol object to use More...
 
void set_checkpoints (checkpoints &&chk_pts)
 assign a set of blockchain checkpoint hashes More...
 
void set_checkpoints_file_path (const std::string &path)
 set the file path to read from when loading checkpoints More...
 
void set_enforce_dns_checkpoints (bool enforce_dns)
 set whether or not we enforce DNS checkpoints More...
 
void disable_dns_checkpoints (bool disable=true)
 set whether or not to enable or disable DNS checkpoints More...
 
bool pool_has_tx (const crypto::hash &txid) const
 checks if the pool has a transaction with the given hash More...
 
bool get_pool_transactions (std::vector< transaction > &txs, bool include_unrelayed_txes=true) const
 get a list of all transactions in the pool More...
 
bool get_txpool_backlog (std::vector< tx_backlog_entry > &backlog) const
 
bool get_pool_transaction_hashes (std::vector< crypto::hash > &txs, bool include_unrelayed_txes=true) const
 get a list of all transactions in the pool More...
 
bool get_pool_transaction_stats (struct txpool_stats &stats, bool include_unrelayed_txes=true) const
 get a list of all transactions in the pool More...
 
bool get_pool_transaction (const crypto::hash &id, cryptonote::blobdata &tx) const
 get a specific transaction from the pool More...
 
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_unrelayed_txes=true) 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 More...
 
size_t get_pool_transactions_count () const
 get the total number of transactions in the pool More...
 
size_t get_blockchain_total_transactions () const
 gets the total number of transactions on the main chain More...
 
bool have_block (const crypto::hash &id) const
 checks if a block is known about with a given hash 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, NOTIFY_RESPONSE_CHAIN_ENTRY::request &resp) const
 get recent block hashes for 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
 
bool get_stat_info (core_stat_info &st_inf) const
 gets some stats about the daemon 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
 
crypto::hash get_tail_id () const
 get the hash of the most recent block on the blockchain More...
 
void set_block_cumulative_difficulty (uint64_t height, difficulty_type diff)
 
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 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...
 
void pause_mine ()
 
void resume_mine ()
 
Blockchainget_blockchain_storage ()
 gets the Blockchain instance More...
 
const Blockchainget_blockchain_storage () const
 gets the Blockchain instance (const) More...
 
std::string print_pool (bool short_format) const
 get a string containing human-readable pool information More...
 
void on_synchronized ()
 
void safesyncmode (const bool onoff)
 Put DB in safe sync mode. More...
 
void set_target_blockchain_height (uint64_t target_blockchain_height)
 sets the target blockchain height More...
 
uint64_t get_target_blockchain_height () const
 gets the target blockchain height More...
 
uint8_t get_ideal_hard_fork_version () const
 returns the newest hardfork version known to the blockchain More...
 
uint8_t get_ideal_hard_fork_version (uint64_t height) const
 return the ideal hard fork version for a given block height More...
 
uint8_t get_hard_fork_version (uint64_t height) const
 return the hard fork version for a given block height More...
 
uint64_t get_earliest_ideal_height_for_version (uint8_t version) const
 return the earliest block a given version may activate More...
 
std::time_t get_start_time () const
 gets start_time More...
 
bool update_checkpoints ()
 tells the Blockchain to update its checkpoints More...
 
std::string get_validators_list ()
 Get a serialized representation of the list of validators. More...
 
electroneum::basic::list_update_outcome set_validators_list (std::string v_list, bool isEmergencyUpdate)
 set the list of validators according to the serialized string passed in as parameter More...
 
bool isValidatorsListValid ()
 get Validators List state More...
 
void graceful_exit ()
 tells the daemon to wind down operations and stop running More...
 
void stop ()
 stops the daemon running More...
 
bool is_key_image_spent (const crypto::key_image &key_im) const
 check if a key image is already spent on the blockchain More...
 
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 More...
 
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 More...
 
size_t get_block_sync_size (uint64_t height) const
 get the number of blocks to sync in one go More...
 
std::pair< uint64_t, uint64_t > get_coinbase_tx_sum (const uint64_t start_offset, const size_t count)
 get the sum of coinbase tx amounts between blocks More...
 
network_type get_nettype () const
 get the network type we're on More...
 
bool is_update_available () const
 check whether an update is known to be available or not More...
 
bool fluffy_blocks_enabled () const
 get whether fluffy blocks are enabled More...
 
bool pad_transactions () const
 get whether transaction relay should be padded More...
 
uint64_t get_free_space () const
 get free disk space on the blockchain partition More...
 
bool offline () const
 get whether the core is running offline More...
 
uint32_t get_blockchain_pruning_seed () const
 get the blockchain pruning seed More...
 
bool prune_blockchain (uint32_t pruning_seed=0)
 prune the blockchain More...
 
bool update_blockchain_pruning ()
 incrementally prunes blockchain More...
 
bool check_blockchain_pruning ()
 checks the blockchain pruning if enabled More...
 
bool set_validator_key (std::string key)
 set validator key More...
 
std::vector< std::string > generate_ed25519_keypair ()
 
std::string sign_message (std::string sk, std::string msg)
 

Static Public Member Functions

static void init_options (boost::program_options::options_description &desc)
 adds command line options to the given options set More...
 

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, bool keeped_by_block, bool relayed, bool do_not_relay)
 
bool add_new_tx (transaction &tx, tx_verification_context &tvc, bool keeped_by_block, bool relayed, bool do_not_relay)
 add a new transaction to the transaction pool More...
 
bool add_new_block (const block &b, block_verification_context &bvc)
 adds a block to the blockchain More...
 
bool load_state_data ()
 load any core state stored on disk More...
 
bool parse_tx_from_blob (transaction &tx, crypto::hash &tx_hash, const blobdata &blob) const
 
bool check_tx_syntax (const transaction &tx) const
 check a transaction's syntax More...
 
bool check_tx_semantic (const transaction &tx, bool keeped_by_block) const
 validates some simple properties of a transaction More...
 
void set_semantics_failed (const crypto::hash &tx_hash)
 
bool handle_incoming_tx_pre (const blobdata &tx_blob, tx_verification_context &tvc, cryptonote::transaction &tx, crypto::hash &tx_hash, bool keeped_by_block, bool relayed, bool do_not_relay)
 
bool handle_incoming_tx_post (const blobdata &tx_blob, tx_verification_context &tvc, cryptonote::transaction &tx, crypto::hash &tx_hash, bool keeped_by_block, bool relayed, bool do_not_relay)
 
bool handle_incoming_tx_accumulated_batch (std::vector< tx_verification_batch_info > &tx_info, bool keeped_by_block)
 
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 More...
 
bool check_tx_inputs_keyimages_diff (const transaction &tx) const
 verify that each input key image in a transaction is unique More...
 
bool check_tx_inputs_ring_members_diff (const transaction &tx) const
 verify that each ring uses distinct members More...
 
bool check_tx_inputs_keyimages_domain (const transaction &tx) const
 verify that each input key image in a transaction is in the valid domain More...
 
bool check_fork_time ()
 checks HardFork status and prints messages about it More...
 
bool relay_txpool_transactions ()
 attempts to relay any transactions in the mempool which need it More...
 
bool check_updates ()
 checks DNS versions More...
 
bool check_disk_space ()
 checks free disk space More...
 
bool check_block_rate ()
 checks block rate, and warns if it's too slow More...
 

Private Attributes

bool m_test_drop_download = true
 whether or not to drop incoming blocks (for testing) More...
 
uint64_t m_test_drop_download_height = 0
 height under which to drop incoming blocks, if doing so More...
 
tx_memory_pool m_mempool
 transaction pool instance More...
 
Blockchain m_blockchain_storage
 Blockchain instance. More...
 
i_cryptonote_protocolm_pprotocol
 cryptonote protocol instance More...
 
epee::critical_section m_incoming_tx_lock
 incoming transaction lock More...
 
miner m_miner
 miner instance More...
 
account_public_address m_miner_address
 address to mine to (for miner instance) More...
 
std::string m_config_folder
 folder to look in for configs and other files More...
 
cryptonote_protocol_stub m_protocol_stub
 cryptonote protocol stub instance More...
 
epee::math_helper::once_a_time_seconds< 60 *60 *12, falsem_store_blockchain_interval
 interval for manual storing of Blockchain, if enabled More...
 
epee::math_helper::once_a_time_seconds< 60 *60 *2, truem_fork_moaner
 interval for checking HardFork status More...
 
epee::math_helper::once_a_time_seconds< 60 *2, falsem_txpool_auto_relayer
 interval for checking re-relaying txpool transactions More...
 
epee::math_helper::once_a_time_seconds< 60 *60 *12, truem_check_updates_interval
 interval for checking for new versions More...
 
epee::math_helper::once_a_time_seconds< 60 *10, truem_check_disk_space_interval
 interval for checking for disk space More...
 
epee::math_helper::once_a_time_seconds< 90, falsem_block_rate_interval
 interval for checking block rate More...
 
epee::math_helper::once_a_time_seconds< 60 *60 *5, truem_blockchain_pruning_interval
 interval for incremental blockchain pruning More...
 
epee::math_helper::once_a_time_seconds< 60 *2, truem_check_validators_interval
 
std::atomic< boolm_starter_message_showed
 has the "daemon will sync now" message been shown? More...
 
uint64_t m_target_blockchain_height
 blockchain height target More...
 
network_type m_nettype
 which network are we on? More...
 
std::atomic< boolm_update_available
 
std::string m_checkpoints_path
 path to json checkpoints file More...
 
time_t m_last_dns_checkpoints_update
 time when dns checkpoints were last updated More...
 
time_t m_last_json_checkpoints_update
 time when json checkpoints were last updated More...
 
std::atomic_flag m_checkpoints_updating
 set if checkpoints are currently updating to avoid multiple threads attempting to update at once More...
 
bool m_disable_dns_checkpoints
 
size_t block_sync_size
 
time_t start_time
 
std::unordered_set< crypto::hashbad_semantics_txes [2]
 
boost::mutex bad_semantics_txes_lock
 
std::unique_ptr< electroneum::basic::Validatorsm_validators
 
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_fluffy_blocks_enabled
 
bool m_offline
 
bool m_pad_transactions
 
std::shared_ptr< tools::Notifym_block_rate_notify
 
bool m_fallback_to_pow
 
std::string m_fallback_to_pow_checkpoint_hash
 
uint64_t m_fallback_to_pow_checkpoint_height
 

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 
)
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
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,
bool  keeped_by_block,
bool  relayed,
bool  do_not_relay 
)
private

Parameters
tx_hashthe transaction's hash
blobthe transaction as a blob
tx_weightthe weight of the transaction
relayedwhether or not the transaction was relayed to us
do_not_relaywhether to prevent the transaction from being relayed

◆ add_new_tx() [2/2]

bool cryptonote::core::add_new_tx ( transaction tx,
tx_verification_context tvc,
bool  keeped_by_block,
bool  relayed,
bool  do_not_relay 
)
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
keeped_by_blockwhether or not the transaction has been in a block
relayedwhether or not the transaction was relayed to us
do_not_relaywhether to prevent the transaction from being relayed
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_fork_time()

bool cryptonote::core::check_fork_time ( )
private

checks HardFork status and prints messages about it

Checks the status of HardFork and logs/prints if an update to the daemon is necessary.

Note
see Blockchain::get_hard_fork_state and HardFork::State
Returns
true

◆ 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) const
private

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) const
private

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
private

verify that each ring uses distinct members

Parameters
txthe transaction to check
Returns
false if any ring uses duplicate members, true otherwise

◆ check_tx_semantic()

bool cryptonote::core::check_tx_semantic ( const transaction tx,
bool  keeped_by_block 
) const
private

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
keeped_by_blockif the transaction has been in a block
Returns
true if all the checks pass, otherwise false

◆ check_tx_syntax()

bool cryptonote::core::check_tx_syntax ( const transaction tx) const
private

check a transaction's syntax

For now this does nothing, but it may check something about the tx in the future.

Parameters
txthe transaction to check
Returns
true

◆ 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,
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
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_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

◆ fluffy_blocks_enabled()

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

get whether fluffy blocks are enabled

Returns
whether fluffy blocks are enabled

◆ generate_ed25519_keypair()

std::vector< std::string > cryptonote::core::generate_ed25519_keypair ( )

◆ 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 
)
virtual

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 
)
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_coinbase_tx_sum()

std::pair< uint64_t, uint64_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

get the current height of the blockchain

Returns
the height
Note
see Blockchain::get_current_blockchain_height()

◆ 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_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_transaction()

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

get a specific transaction from the pool

Parameters
hthe hash of the transaction to get
txreturn-by-reference the transaction blob requested
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_unrelayed_txes = true 
) const

get a list of all transactions in the pool

Parameters
txsreturn-by-reference the list of transactions
include_unrelayed_txesinclude unrelayed txes in the result
include_unrelayed_txesinclude unrelayed txes in result
Note
see tx_memory_pool::get_transactions

◆ get_pool_transaction_stats()

bool cryptonote::core::get_pool_transaction_stats ( struct txpool_stats stats,
bool  include_unrelayed_txes = true 
) const

get a list of all transactions in the pool

Parameters
txsreturn-by-reference the list of transactions
include_unrelayed_txesinclude unrelayed txes in the result
include_unrelayed_txesinclude unrelayed txes in result
Note
see tx_memory_pool::get_transactions

◆ get_pool_transactions()

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

get a list of all transactions in the pool

Parameters
txsreturn-by-reference the list of transactions
include_unrelayed_txesinclude unrelayed txes in the result
include_unrelayed_txesinclude unrelayed txes in result
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_unrelayed_txes = true 
) const

Parameters
include_unrelayed_txesinclude unrelayed txes in result
Note
see tx_memory_pool::get_pool_transactions_and_spent_keys_info

◆ get_pool_transactions_count()

size_t cryptonote::core::get_pool_transactions_count ( ) const

get the total number of transactions in the pool

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

◆ 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) 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
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_stat_info()

bool cryptonote::core::get_stat_info ( core_stat_info st_inf) const

gets some stats about the daemon

Parameters
st_infreturn-by-reference container for the stats requested
Returns
true

◆ 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 
) 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 
) 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) const

Note
see tx_memory_pool::get_txpool_backlog

◆ get_validators_list()

std::string cryptonote::core::get_validators_list ( )

Get a serialized representation of the list of validators.

Returns
serialized string

◆ 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 
)
virtual

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()

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

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.

Parameters
block_blobthe block to be added
blockthe block to be added, or NULL
bvcreturn-by-reference metadata context about the block's validity
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_tx()

bool cryptonote::core::handle_incoming_tx ( const blobdata tx_blob,
tx_verification_context tvc,
bool  keeped_by_block,
bool  relayed,
bool  do_not_relay 
)

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
keeped_by_blockif the transaction has been in a block
relayedwhether or not the transaction was relayed to us
do_not_relaywhether to prevent the transaction from being relayed
Returns
true if the transaction was accepted, false otherwise

◆ handle_incoming_tx_accumulated_batch()

bool cryptonote::core::handle_incoming_tx_accumulated_batch ( std::vector< tx_verification_batch_info > &  tx_info,
bool  keeped_by_block 
)
private

◆ handle_incoming_tx_post()

bool cryptonote::core::handle_incoming_tx_post ( const blobdata tx_blob,
tx_verification_context tvc,
cryptonote::transaction tx,
crypto::hash tx_hash,
bool  keeped_by_block,
bool  relayed,
bool  do_not_relay 
)
private

◆ handle_incoming_tx_pre()

bool cryptonote::core::handle_incoming_tx_pre ( const blobdata tx_blob,
tx_verification_context tvc,
cryptonote::transaction tx,
crypto::hash tx_hash,
bool  keeped_by_block,
bool  relayed,
bool  do_not_relay 
)
private

◆ handle_incoming_txs()

bool cryptonote::core::handle_incoming_txs ( const std::vector< blobdata > &  tx_blobs,
std::vector< tx_verification_context > &  tvc,
bool  keeped_by_block,
bool  relayed,
bool  do_not_relay 
)

handles a list of incoming transactions

Parses incoming transactions and, if nothing is obviously wrong, passes them along to the transaction pool

Parameters
tx_blobsthe txs to handle
tvcmetadata about the transactions' validity
keeped_by_blockif the transactions have been in a block
relayedwhether or not the transactions were relayed to us
do_not_relaywhether to prevent the transactions from being relayed
Returns
true if the transactions were accepted, false otherwise

◆ have_block()

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

◆ init()

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

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
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_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

◆ isValidatorsListValid()

bool cryptonote::core::isValidatorsListValid ( )

get Validators List state

Returns
true if valid, false if invalid or expired

◆ 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

◆ 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_transaction_relayed()

void cryptonote::core::on_transaction_relayed ( const cryptonote::blobdata tx)
virtual

called when a transaction is relayed

◆ pad_transactions()

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

get whether transaction relay should be padded

Returns
whether transaction relay should be padded

◆ parse_tx_from_blob()

bool cryptonote::core::parse_tx_from_blob ( transaction tx,
crypto::hash tx_hash,
const blobdata blob 
) const
private

Note
see parse_tx_from_blob(transaction&, crypto::hash&, crypto::hash&, const blobdata&) const

◆ 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
Returns
true if the transaction is in the pool, otherwise false
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

◆ 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

◆ 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_block_cumulative_difficulty()

void cryptonote::core::set_block_cumulative_difficulty ( uint64_t  height,
difficulty_type  diff 
)

Note
see Blockchain::set_block_cumulative_difficulty

◆ 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_semantics_failed()

void cryptonote::core::set_semantics_failed ( const crypto::hash tx_hash)
private

◆ 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

◆ set_validator_key()

bool cryptonote::core::set_validator_key ( std::string  key)

set validator key

Parameters
keykey to set as new validator key
Returns
whether this new key was set or not

◆ set_validators_list()

electroneum::basic::list_update_outcome cryptonote::core::set_validators_list ( std::string  v_list,
bool  isEmergencyUpdate 
)

set the list of validators according to the serialized string passed in as parameter

Parameters
v_listserialized validators list string
Returns
true if successfull

◆ sign_message()

std::string cryptonote::core::sign_message ( std::string  sk,
std::string  msg 
)

◆ 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 ( )

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

◆ bad_semantics_txes

std::unordered_set<crypto::hash> cryptonote::core::bad_semantics_txes[2]
private

◆ bad_semantics_txes_lock

boost::mutex cryptonote::core::bad_semantics_txes_lock
private

◆ 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_check_validators_interval

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

◆ 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_disable_dns_checkpoints

bool cryptonote::core::m_disable_dns_checkpoints
private

◆ m_fallback_to_pow

bool cryptonote::core::m_fallback_to_pow
private

◆ m_fallback_to_pow_checkpoint_hash

std::string cryptonote::core::m_fallback_to_pow_checkpoint_hash
private

◆ m_fallback_to_pow_checkpoint_height

uint64_t cryptonote::core::m_fallback_to_pow_checkpoint_height
private

◆ m_fluffy_blocks_enabled

bool cryptonote::core::m_fluffy_blocks_enabled
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_miner_address

account_public_address cryptonote::core::m_miner_address
private

address to mine to (for 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_pad_transactions

bool cryptonote::core::m_pad_transactions
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_txpool_auto_relayer

epee::math_helper::once_a_time_seconds<60*2, false> cryptonote::core::m_txpool_auto_relayer
private

interval for checking re-relaying txpool transactions

◆ 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

◆ m_validators

std::unique_ptr<electroneum::basic::Validators> cryptonote::core::m_validators
private

◆ start_time

time_t cryptonote::core::start_time
private

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