|
Electroneum
|
handles core cryptonote functionality More...
#include <cryptonote_core.h>


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_protocol * | get_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... | |
| miner & | get_miner () |
| gets the miner instance More... | |
| const miner & | get_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 () |
| Blockchain & | get_blockchain_storage () |
| gets the Blockchain instance More... | |
| const Blockchain & | get_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_protocol * | m_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, false > | m_store_blockchain_interval |
| interval for manual storing of Blockchain, if enabled More... | |
| epee::math_helper::once_a_time_seconds< 60 *60 *2, true > | m_fork_moaner |
| interval for checking HardFork status More... | |
| epee::math_helper::once_a_time_seconds< 60 *2, false > | m_txpool_auto_relayer |
| interval for checking re-relaying txpool transactions More... | |
| epee::math_helper::once_a_time_seconds< 60 *60 *12, true > | m_check_updates_interval |
| interval for checking for new versions More... | |
| epee::math_helper::once_a_time_seconds< 60 *10, true > | m_check_disk_space_interval |
| interval for checking for disk space More... | |
| epee::math_helper::once_a_time_seconds< 90, false > | m_block_rate_interval |
| interval for checking block rate More... | |
| epee::math_helper::once_a_time_seconds< 60 *60 *5, true > | m_blockchain_pruning_interval |
| interval for incremental blockchain pruning More... | |
| epee::math_helper::once_a_time_seconds< 60 *2, true > | m_check_validators_interval |
| std::atomic< bool > | m_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< bool > | m_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::hash > | bad_semantics_txes [2] |
| boost::mutex | bad_semantics_txes_lock |
| std::unique_ptr< electroneum::basic::Validators > | m_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::Notify > | m_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 () | |
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.
| cryptonote::core::core | ( | i_cryptonote_protocol * | pprotocol | ) |
constructor
sets member variables into a usable state
| pprotocol | pre-constructed protocol object to store and use |
|
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.
| bl_ | the block to be added |
| bvc | metadata about the block addition's success/failure |
|
private |
| tx_hash | the transaction's hash |
| blob | the transaction as a blob |
| tx_weight | the weight of the transaction |
| relayed | whether or not the transaction was relayed to us |
| do_not_relay | whether to prevent the transaction from being relayed |
|
private |
add a new transaction to the transaction pool
Adds a new transaction to the transaction pool.
| tx | the transaction to add |
| tvc | return-by-reference metadata about the transaction's verification process |
| keeped_by_block | whether or not the transaction has been in a block |
| relayed | whether or not the transaction was relayed to us |
| do_not_relay | whether to prevent the transaction from being relayed |
| 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()
| key_im | list of key images to check |
| spent | return-by-reference result for each image checked |
| 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
| key_im | list of key images to check |
| spent | return-by-reference result for each image checked |
|
private |
checks block rate, and warns if it's too slow
| bool cryptonote::core::check_blockchain_pruning | ( | ) |
checks the blockchain pruning if enabled
|
private |
checks free disk space
|
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.
check the size of a block against the current maximum
| block_blob | the block to check |
|
private |
verify that each input key image in a transaction is unique
| tx | the transaction to check |
|
private |
verify that each input key image in a transaction is in the valid domain
| tx | the transaction to check |
|
private |
verify that each ring uses distinct members
| tx | the transaction to check |
|
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.
| tx | the transaction to check |
| keeped_by_block | if the transaction has been in a block |
|
private |
check a transaction's syntax
For now this does nothing, but it may check something about the tx in the future.
| tx | the transaction to check |
|
private |
checks DNS versions
incoming blocks post-processing, cleanup, and disk sync
| force_sync | if true, and Blockchain is handling syncing to disk, always sync |
| bool cryptonote::core::deinit | ( | ) |
performs safe shutdown steps for core and core components
Uninitializes the miner instance, transaction pool, and Blockchain
set whether or not to enable or disable DNS checkpoints
| disble | whether to disable DNS checkpoints |
| 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.
| qblock_ids | the foreign chain's "short history" (see get_short_chain_history) |
| resp | return-by-reference the split height and subsequent blocks' hashes |
| 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 |
|
inline |
get whether fluffy blocks are enabled
| std::vector< std::string > cryptonote::core::generate_ed25519_keypair | ( | ) |
compiles a list of all blocks stored as alternative chains
| blocks | return-by-reference container to put result blocks in |
| size_t cryptonote::core::get_alternative_blocks_count | ( | ) | const |
returns the number of alternative blocks stored
| bool cryptonote::core::get_block_by_hash | ( | const crypto::hash & | h, |
| block & | blk, | ||
| bool * | orphan = NULL |
||
| ) | const |
gets the block with a given hash
| h | the hash to look for |
| blk | return-by-reference variable to put result block in |
| orphan | if non-NULL, will be set to true if not in the main chain, false otherwise |
| difficulty_type cryptonote::core::get_block_cumulative_difficulty | ( | uint64_t | height | ) | const |
| crypto::hash cryptonote::core::get_block_id_by_height | ( | uint64_t | height | ) | const |
gets a block's hash given a height
| height | the height of the block |
| size_t cryptonote::core::get_block_sync_size | ( | uint64_t | height | ) | const |
get the number of blocks to sync in one go
|
virtual |
creates a new block to mine against
| b | return-by-reference block to be filled in |
| from_block | optional block hash to start mining from (main chain tip if NULL) |
| miner_address | address new coins for the block will go to |
| di | return-by-reference tells the miner what the difficulty target is |
| height | return-by-reference tells the miner what height it's mining against |
| expected_reward | return-by-reference the total reward awarded to the miner finding this block, including transaction fees |
| ex_nonce | extra data to be added to the miner transaction's extra |
Implements cryptonote::i_miner_handler.
|
virtual |
| uint32_t cryptonote::core::get_blockchain_pruning_seed | ( | ) | const |
get the blockchain pruning seed
|
inline |
gets the Blockchain instance
|
inline |
gets the Blockchain instance (const)
| void cryptonote::core::get_blockchain_top | ( | uint64_t & | height, |
| crypto::hash & | top_id | ||
| ) | const |
get the hash and height of the most recent block
| height | return-by-reference height of the block |
| top_id | return-by-reference hash of the block |
| size_t cryptonote::core::get_blockchain_total_transactions | ( | ) | const |
gets the total number of transactions on the main chain
|
inline |
gets blocks based on a list of block hashes
| t_ids_container | a standard-iterable container |
| t_blocks_container | a standard-iterable container |
| t_missed_container | a standard-iterable container |
| block_ids | a container of block hashes for which to get the corresponding blocks |
| blocks | return-by-reference a container to store result blocks in |
| missed_bs | return-by-reference a container to store missed blocks in |
| 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
| start_offset | the height on the blockchain to start at |
| count | the number of blocks to get, if there are as many after start_offset |
| blocks | return-by-reference container to put result blocks in |
| 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
| start_offset | the height on the blockchain to start at |
| count | the number of blocks to get, if there are as many after start_offset |
| blocks | return-by-reference container to put result blocks in |
| 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 |
| 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
| uint64_t cryptonote::core::get_current_blockchain_height | ( | ) | const |
get the current height of the blockchain
| uint64_t cryptonote::core::get_earliest_ideal_height_for_version | ( | uint8_t | version | ) | const |
return the earliest block a given version may activate
| uint64_t cryptonote::core::get_free_space | ( | ) | const |
get free disk space on the blockchain partition
| uint8_t cryptonote::core::get_hard_fork_version | ( | uint64_t | height | ) | const |
return the hard fork version for a given block height
| uint8_t cryptonote::core::get_ideal_hard_fork_version | ( | ) | const |
returns the newest hardfork version known to the blockchain
| uint8_t cryptonote::core::get_ideal_hard_fork_version | ( | uint64_t | height | ) | const |
return the ideal hard fork version for a given block height
|
inline |
gets the miner instance
|
inline |
gets the miner instance (const)
|
inline |
get the network type we're on
| 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
| amount | the amount to get a ditribution for |
| from_height | the height before which we do not care about the data |
| to_height | the height after which we do not care about the data |
| return-by-reference | start_height the height of the first rct output |
| return-by-reference | distribution the start offset of the first rct output in this block (same as previous if none) |
| return-by-reference | base how many outputs of that amount are before the stated distribution |
get per block distribution of outputs of a given amount
| 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.
| req | the outputs to return |
| res | return-by-reference the resultant output indices and keys |
| 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
| tx_infos | [out] the transactions' information |
| key_image_infos | [out] the spent key images' information |
| bool cryptonote::core::get_pool_transaction | ( | const crypto::hash & | id, |
| cryptonote::blobdata & | tx | ||
| ) | const |
get a specific transaction from the pool
| h | the hash of the transaction to get |
| tx | return-by-reference the transaction blob requested |
| 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
| txs | return-by-reference the list of transactions |
| include_unrelayed_txes | include unrelayed txes in the result |
| include_unrelayed_txes | include unrelayed txes in result |
| 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
| txs | return-by-reference the list of transactions |
| include_unrelayed_txes | include unrelayed txes in the result |
| include_unrelayed_txes | include unrelayed txes in result |
| 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
| txs | return-by-reference the list of transactions |
| include_unrelayed_txes | include unrelayed txes in the result |
| include_unrelayed_txes | include unrelayed txes in result |
| 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 |
| include_unrelayed_txes | include unrelayed txes in result |
| size_t cryptonote::core::get_pool_transactions_count | ( | ) | const |
get the total number of transactions in the pool
|
inline |
get the cryptonote protocol instance
| 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...
| ids | return-by-reference list to put the resulting hashes in |
| 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 |
| std::time_t cryptonote::core::get_start_time | ( | ) | const |
gets start_time
| bool cryptonote::core::get_stat_info | ( | core_stat_info & | st_inf | ) | const |
gets some stats about the daemon
| st_inf | return-by-reference container for the stats requested |
| crypto::hash cryptonote::core::get_tail_id | ( | ) | const |
get the hash of the most recent block on the blockchain
| uint64_t cryptonote::core::get_target_blockchain_height | ( | ) | const |
gets the target blockchain height
| target_blockchain_height | the target height |
| bool cryptonote::core::get_test_drop_download | ( | ) | const |
gets whether or not to drop blocks (for testing)
| 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
| bool cryptonote::core::get_transactions | ( | const std::vector< crypto::hash > & | txs_ids, |
| std::vector< cryptonote::blobdata > & | txs, | ||
| std::vector< crypto::hash > & | missed_txs | ||
| ) | const |
| bool cryptonote::core::get_transactions | ( | const std::vector< crypto::hash > & | txs_ids, |
| std::vector< transaction > & | txs, | ||
| std::vector< crypto::hash > & | missed_txs | ||
| ) | const |
| bool cryptonote::core::get_tx_outputs_gindexs | ( | const crypto::hash & | tx_id, |
| size_t | n_txes, | ||
| std::vector< std::vector< uint64_t >> & | indexs | ||
| ) | const |
| 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.
| tx_id | the hash of the transaction to fetch indices for |
| indexs | return-by-reference the global indices for the transaction's outputs |
| n_txes | how many txes in a row to get results for |
| bool cryptonote::core::get_txpool_backlog | ( | std::vector< tx_backlog_entry > & | backlog | ) | const |
| std::string cryptonote::core::get_validators_list | ( | ) |
Get a serialized representation of the list of validators.
| 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.
|
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.
| b | the block found |
| bvc | returns the block verification flags |
Implements cryptonote::i_miner_handler.
|
private |
act on a set of command line options given
| vm | the command line options |
| 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.
| arg | the request |
| rsp | return-by-reference the response to fill in |
| context | connection context associated with the request |
| 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.
| block_blob | the block to be added |
| block | the block to be added, or NULL |
| bvc | return-by-reference metadata context about the block's validity |
| update_miner_blocktemplate | whether or not to update the miner's block template |
| 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
| tx_blob | the tx to handle |
| tvc | metadata about the transaction's validity |
| keeped_by_block | if the transaction has been in a block |
| relayed | whether or not the transaction was relayed to us |
| do_not_relay | whether to prevent the transaction from being relayed |
|
private |
|
private |
|
private |
| 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
| tx_blobs | the txs to handle |
| tvc | metadata about the transactions' validity |
| keeped_by_block | if the transactions have been in a block |
| relayed | whether or not the transactions were relayed to us |
| do_not_relay | whether to prevent the transactions from being relayed |
| 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
| id | the hash to search for |
| 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)
| vm | command line parameters |
| test_options | configuration options for testing |
| get_checkpoints | if 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 |
|
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.
| desc | return-by-reference the command line options set to add to |
| 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.
| key_im | the key image to search for |
|
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
| bool cryptonote::core::isValidatorsListValid | ( | ) |
get Validators List state
|
private |
load any core state stored on disk
currently does nothing, but may have state to load in the future.
|
inline |
get whether the core is running offline
| bool cryptonote::core::on_idle | ( | ) |
| void cryptonote::core::on_synchronized | ( | ) |
|
virtual |
called when a transaction is relayed
|
inline |
get whether transaction relay should be padded
|
private |
| void cryptonote::core::pause_mine | ( | ) |
| bool cryptonote::core::pool_has_tx | ( | const crypto::hash & | txid | ) | const |
checks if the pool has a transaction with the given hash
| id | the hash to look for |
| 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
| blocks_entry | a list of incoming blocks |
| blocks | the parsed blocks |
| std::string cryptonote::core::print_pool | ( | bool | short_format | ) | const |
get a string containing human-readable pool information
| short_format | whether to use a shortened format for the info |
| bool cryptonote::core::prune_blockchain | ( | uint32_t | pruning_seed = 0 | ) |
prune the blockchain
| pruning_seed | the seed to use to prune the chain (0 for default, highly recommended) |
|
private |
attempts to relay any transactions in the mempool which need it
| void cryptonote::core::resume_mine | ( | ) |
| void cryptonote::core::safesyncmode | ( | const bool | onoff | ) |
Put DB in safe sync mode.
2note see Blockchain::safesyncmode
| void cryptonote::core::set_block_cumulative_difficulty | ( | uint64_t | height, |
| difficulty_type | diff | ||
| ) |
| void cryptonote::core::set_checkpoints | ( | checkpoints && | chk_pts | ) |
assign a set of blockchain checkpoint hashes
| chk_pts | the set of checkpoints to assign |
| void cryptonote::core::set_checkpoints_file_path | ( | const std::string & | path | ) |
set the file path to read from when loading checkpoints
| path | the path to set ours as |
| void cryptonote::core::set_cryptonote_protocol | ( | i_cryptonote_protocol * | pprotocol | ) |
set the pointer to the cryptonote protocol object to use
| pprotocol | the pointer to set ours as |
| void cryptonote::core::set_enforce_dns_checkpoints | ( | bool | enforce_dns | ) |
set whether or not we enforce DNS checkpoints
| enforce_dns | enforce DNS checkpoints or not |
clears the blockchain and starts a new one
| b | the first block in the new chain (the genesis block) |
|
private |
| void cryptonote::core::set_target_blockchain_height | ( | uint64_t | target_blockchain_height | ) |
sets the target blockchain height
| target_blockchain_height | the height to set |
| bool cryptonote::core::set_validator_key | ( | std::string | key | ) |
set validator key
| key | key to set as new validator key |
| 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
| v_list | serialized validators list string |
| std::string cryptonote::core::sign_message | ( | std::string | sk, |
| std::string | msg | ||
| ) |
| void cryptonote::core::stop | ( | ) |
stops the daemon running
| void cryptonote::core::test_drop_download | ( | ) |
sets to drop blocks downloaded (for testing)
| void cryptonote::core::test_drop_download_height | ( | uint64_t | height | ) |
sets to drop blocks downloaded below a certain height
| height | height below which to drop blocks |
| bool cryptonote::core::update_blockchain_pruning | ( | ) |
incrementally prunes blockchain
| 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.
|
private |
|
private |
|
private |
|
private |
| enum { ... } cryptonote::core::check_updates_level |
|
private |
interval for checking block rate
|
private |
|
private |
interval for incremental blockchain pruning
|
private |
Blockchain instance.
|
private |
interval for checking for disk space
|
private |
interval for checking for new versions
|
private |
|
private |
path to json checkpoints file
|
private |
set if checkpoints are currently updating to avoid multiple threads attempting to update at once
|
private |
folder to look in for configs and other files
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
interval for checking HardFork status
|
private |
incoming transaction lock
|
private |
time when dns checkpoints were last updated
|
private |
time when json checkpoints were last updated
|
private |
|
private |
transaction pool instance
|
private |
miner instance
|
private |
address to mine to (for miner instance)
|
private |
which network are we on?
|
private |
|
private |
|
private |
cryptonote protocol instance
|
private |
cryptonote protocol stub instance
|
private |
has the "daemon will sync now" message been shown?
|
private |
interval for manual storing of Blockchain, if enabled
|
private |
blockchain height target
whether or not to drop incoming blocks (for testing)
|
private |
height under which to drop incoming blocks, if doing so
|
private |
interval for checking re-relaying txpool transactions
|
private |
|
private |
|
private |
|
private |
|
private |