36 #include <boost/program_options/options_description.hpp>
37 #include <boost/program_options/variables_map.hpp>
40 #include "storages/portable_storage_template_helper.h"
145 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);
169 bool prepare_handle_incoming_blocks(
const std::vector<block_complete_entry> &blocks_entry, std::vector<block> &
blocks);
176 bool cleanup_handle_incoming_blocks(
bool force_sync =
false);
185 bool check_incoming_block_size(
const blobdata& block_blob)
const;
246 static void init_options(boost::program_options::options_description& desc);
267 bool set_genesis_block(
const block&
b);
281 void test_drop_download();
288 void test_drop_download_height(uint64_t
height);
295 bool get_test_drop_download()
const;
305 bool get_test_drop_download_height()
const;
312 uint64_t get_current_blockchain_height()
const;
327 bool get_blocks(uint64_t start_offset,
size_t count, std::vector<std::pair<cryptonote::blobdata,block>>&
blocks, std::vector<cryptonote::blobdata>& txs)
const;
334 bool get_blocks(uint64_t start_offset,
size_t count, std::vector<std::pair<cryptonote::blobdata,block>>&
blocks)
const;
341 bool get_blocks(uint64_t start_offset,
size_t count, std::vector<block>&
blocks)
const;
348 template<
class t_
ids_container,
class t_blocks_container,
class t_missed_container>
349 bool get_blocks(
const t_ids_container& block_ids, t_blocks_container&
blocks, t_missed_container& missed_bs)
const
351 return m_blockchain_storage.get_blocks(block_ids,
blocks, missed_bs);
366 bool get_transactions(
const std::vector<crypto::hash>& txs_ids, std::vector<cryptonote::blobdata>& txs, std::vector<crypto::hash>& missed_txs)
const;
373 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;
380 bool get_transactions(
const std::vector<crypto::hash>& txs_ids, std::vector<transaction>& txs, std::vector<crypto::hash>& missed_txs)
const;
387 bool get_block_by_hash(
const crypto::hash &h,
block &blk,
bool *orphan = NULL)
const;
394 bool get_alternative_blocks(std::vector<block>&
blocks)
const;
401 size_t get_alternative_blocks_count()
const;
422 void set_checkpoints_file_path(
const std::string& path);
429 void set_enforce_dns_checkpoints(
bool enforce_dns);
451 bool get_pool_transactions(std::vector<transaction>& txs,
bool include_unrelayed_txes =
true)
const;
458 bool get_txpool_backlog(std::vector<tx_backlog_entry>& backlog)
const;
466 bool get_pool_transaction_hashes(std::vector<crypto::hash>& txs,
bool include_unrelayed_txes =
true)
const;
474 bool get_pool_transaction_stats(
struct txpool_stats& stats,
bool include_unrelayed_txes =
true)
const;
489 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;
503 size_t get_pool_transactions_count()
const;
510 size_t get_blockchain_total_transactions()
const;
524 bool get_short_chain_history(std::list<crypto::hash>& ids)
const;
538 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;
554 bool get_tx_outputs_gindexs(
const crypto::hash& tx_id, std::vector<uint64_t>& indexs)
const;
555 bool get_tx_outputs_gindexs(
const crypto::hash& tx_id,
size_t n_txes, std::vector<std::vector<uint64_t>>& indexs)
const;
590 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;
625 std::string print_pool(
bool short_format)
const;
632 void on_synchronized();
639 void safesyncmode(
const bool onoff);
646 void set_target_blockchain_height(uint64_t target_blockchain_height);
653 uint64_t get_target_blockchain_height()
const;
660 uint8_t get_ideal_hard_fork_version()
const;
667 uint8_t get_ideal_hard_fork_version(uint64_t
height)
const;
674 uint8_t get_hard_fork_version(uint64_t
height)
const;
681 uint64_t get_earliest_ideal_height_for_version(uint8_t
version)
const;
687 std::time_t get_start_time()
const;
699 bool update_checkpoints();
706 std::string get_validators_list();
721 bool isValidatorsListValid();
729 void graceful_exit();
755 bool are_key_images_spent(
const std::vector<crypto::key_image>& key_im, std::vector<bool> &spent)
const;
765 bool are_key_images_spent_in_pool(
const std::vector<crypto::key_image>& key_im, std::vector<bool> &spent)
const;
772 size_t get_block_sync_size(uint64_t
height)
const;
779 std::pair<uint64_t, uint64_t> get_coinbase_tx_sum(
const uint64_t start_offset,
const size_t count);
817 uint64_t get_free_space()
const;
831 uint32_t get_blockchain_pruning_seed()
const;
840 bool prune_blockchain(uint32_t pruning_seed = 0);
847 bool update_blockchain_pruning();
854 bool check_blockchain_pruning();
863 bool set_validator_key(std::string key);
865 std::vector<std::string> generate_ed25519_keypair();
867 std::string
sign_message(std::string sk, std::string msg);
914 bool load_state_data();
951 bool check_tx_semantic(
const transaction& tx,
bool keeped_by_block)
const;
957 bool handle_incoming_tx_accumulated_batch(std::vector<tx_verification_batch_info> &
tx_info,
bool keeped_by_block);
966 bool update_miner_block_template();
975 bool handle_command_line(
const boost::program_options::variables_map& vm);
984 bool check_tx_inputs_keyimages_diff(
const transaction& tx)
const;
993 bool check_tx_inputs_ring_members_diff(
const transaction& tx)
const;
1003 bool check_tx_inputs_keyimages_domain(
const transaction& tx)
const;
1015 bool check_fork_time();
1022 bool relay_txpool_transactions();
1036 bool check_disk_space();
1043 bool check_block_rate();
1045 bool m_test_drop_download =
true;
1047 uint64_t m_test_drop_download_height = 0;
1092 std::unordered_set<crypto::hash> bad_semantics_txes[2];
1104 } check_updates_level;
uint64_t height
Definition: blockchain.cpp:91
uint8_t version
Definition: blockchain.cpp:90
static void init(std::string cache_filename)
Definition: blockchain_blackball.cpp:224
Definition: blockchain.h:95
A container for blockchain checkpoints.
Definition: checkpoints.h:52
handles core cryptonote functionality
Definition: cryptonote_core.h:86
epee::math_helper::once_a_time_seconds< 60 *60 *5, true > m_blockchain_pruning_interval
interval for incremental blockchain pruning
Definition: cryptonote_core.h:1070
size_t block_sync_size
Definition: cryptonote_core.h:1088
epee::math_helper::once_a_time_seconds< 60 *2, false > m_txpool_auto_relayer
interval for checking re-relaying txpool transactions
Definition: cryptonote_core.h:1066
bool m_offline
Definition: cryptonote_core.h:1111
tx_memory_pool m_mempool
transaction pool instance
Definition: cryptonote_core.h:1049
bool m_pad_transactions
Definition: cryptonote_core.h:1112
epee::math_helper::once_a_time_seconds< 60 *60 *2, true > m_fork_moaner
interval for checking HardFork status
Definition: cryptonote_core.h:1065
epee::math_helper::once_a_time_seconds< 60 *60 *12, true > m_check_updates_interval
interval for checking for new versions
Definition: cryptonote_core.h:1067
std::shared_ptr< tools::Notify > m_block_rate_notify
Definition: cryptonote_core.h:1114
time_t m_last_json_checkpoints_update
time when json checkpoints were last updated
Definition: cryptonote_core.h:1083
std::unique_ptr< electroneum::basic::Validators > m_validators
Definition: cryptonote_core.h:1097
epee::math_helper::once_a_time_seconds< 90, false > m_block_rate_interval
interval for checking block rate
Definition: cryptonote_core.h:1069
uint64_t m_fallback_to_pow_checkpoint_height
Definition: cryptonote_core.h:1118
bool fluffy_blocks_enabled() const
get whether fluffy blocks are enabled
Definition: cryptonote_core.h:803
network_type m_nettype
which network are we on?
Definition: cryptonote_core.h:1077
bool is_update_available() const
check whether an update is known to be available or not
Definition: cryptonote_core.h:796
miner m_miner
miner instance
Definition: cryptonote_core.h:1057
Blockchain m_blockchain_storage
Blockchain instance.
Definition: cryptonote_core.h:1050
std::string m_config_folder
folder to look in for configs and other files
Definition: cryptonote_core.h:1060
uint64_t m_target_blockchain_height
blockchain height target
Definition: cryptonote_core.h:1075
Blockchain & get_blockchain_storage()
gets the Blockchain instance
Definition: cryptonote_core.h:611
bool m_disable_dns_checkpoints
Definition: cryptonote_core.h:1086
std::atomic_flag m_checkpoints_updating
set if checkpoints are currently updating to avoid multiple threads attempting to update at once
Definition: cryptonote_core.h:1085
const miner & get_miner() const
gets the miner instance (const)
Definition: cryptonote_core.h:236
std::string m_checkpoints_path
path to json checkpoints file
Definition: cryptonote_core.h:1081
epee::math_helper::once_a_time_seconds< 60 *2, true > m_check_validators_interval
Definition: cryptonote_core.h:1071
epee::math_helper::once_a_time_seconds< 60 *60 *12, false > m_store_blockchain_interval
interval for manual storing of Blockchain, if enabled
Definition: cryptonote_core.h:1064
account_public_address m_miner_address
address to mine to (for miner instance)
Definition: cryptonote_core.h:1058
bool offline() const
get whether the core is running offline
Definition: cryptonote_core.h:824
network_type get_nettype() const
get the network type we're on
Definition: cryptonote_core.h:786
std::atomic< bool > m_starter_message_showed
has the "daemon will sync now" message been shown?
Definition: cryptonote_core.h:1073
i_cryptonote_protocol * get_protocol()
get the cryptonote protocol instance
Definition: cryptonote_core.h:192
tools::download_async_handle m_update_download
Definition: cryptonote_core.h:1106
void disable_dns_checkpoints(bool disable=true)
set whether or not to enable or disable DNS checkpoints
Definition: cryptonote_core.h:436
epee::critical_section m_incoming_tx_lock
incoming transaction lock
Definition: cryptonote_core.h:1054
bool m_fallback_to_pow
Definition: cryptonote_core.h:1116
std::atomic< bool > m_update_available
Definition: cryptonote_core.h:1079
std::string m_fallback_to_pow_checkpoint_hash
Definition: cryptonote_core.h:1117
miner & get_miner()
gets the miner instance
Definition: cryptonote_core.h:229
size_t m_last_update_length
Definition: cryptonote_core.h:1107
boost::mutex bad_semantics_txes_lock
Definition: cryptonote_core.h:1093
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
Definition: cryptonote_core.h:349
i_cryptonote_protocol * m_pprotocol
cryptonote protocol instance
Definition: cryptonote_core.h:1052
cryptonote_protocol_stub m_protocol_stub
cryptonote protocol stub instance
Definition: cryptonote_core.h:1062
epee::math_helper::once_a_time_seconds< 60 *10, true > m_check_disk_space_interval
interval for checking for disk space
Definition: cryptonote_core.h:1068
boost::mutex m_update_mutex
Definition: cryptonote_core.h:1108
bool pad_transactions() const
get whether transaction relay should be padded
Definition: cryptonote_core.h:810
const Blockchain & get_blockchain_storage() const
gets the Blockchain instance (const)
Definition: cryptonote_core.h:618
time_t start_time
Definition: cryptonote_core.h:1090
time_t m_last_dns_checkpoints_update
time when dns checkpoints were last updated
Definition: cryptonote_core.h:1082
@ UPDATES_NOTIFY
Definition: cryptonote_core.h:1101
@ UPDATES_UPDATE
Definition: cryptonote_core.h:1103
@ UPDATES_DOWNLOAD
Definition: cryptonote_core.h:1102
@ UPDATES_DISABLED
Definition: cryptonote_core.h:1100
bool m_fluffy_blocks_enabled
Definition: cryptonote_core.h:1110
Definition: cryptonote_basic.h:205
Transaction pool, handles transactions which are not part of a block.
Definition: tx_pool.h:95
PUSH_WARNINGS
Definition: hash-ops.h:54
int b
Definition: base.py:1
Definition: blocks.cpp:13
POD_CLASS key_image
Definition: crypto.h:102
POD_CLASS hash
Definition: hash.h:50
std::string sign_message(const std::string &message, const std::string &privateKey)
Definition: crypto.h:352
std::unordered_map< crypto::key_image, std::vector< crypto::hash > > key_images_with_tx_hashes
Definition: message_data_structs.h:106
Holds cryptonote related classes and helpers.
Definition: db_bdb.cpp:226
const command_line::arg_descriptor< std::string, false, true, 2 > arg_data_dir
Definition: cryptonote_core.cpp:96
boost::multiprecision::uint128_t difficulty_type
Definition: difficulty.h:43
network_type
Definition: cryptonote_config.h:243
const command_line::arg_descriptor< bool > arg_regtest_on
Definition: cryptonote_core.cpp:81
const command_line::arg_descriptor< bool > arg_offline
Definition: cryptonote_core.cpp:109
const command_line::arg_descriptor< difficulty_type > arg_fixed_difficulty
Definition: cryptonote_core.cpp:86
const command_line::arg_descriptor< bool > arg_fallback_to_pow
Definition: cryptonote_core.cpp:223
const command_line::arg_descriptor< bool, false > arg_testnet_on
Definition: cryptonote_core.cpp:71
const command_line::arg_descriptor< std::string > arg_fallback_to_pow_checkpoint_hash
Definition: cryptonote_core.cpp:240
const command_line::arg_descriptor< bool, false > arg_stagenet_on
Definition: cryptonote_core.cpp:76
const command_line::arg_descriptor< uint64_t > arg_fallback_to_pow_checkpoint_height
Definition: cryptonote_core.cpp:234
std::string blobdata
Definition: blobdatatype.h:39
const command_line::arg_descriptor< bool > arg_skip_block_sig_verification
Definition: cryptonote_core.cpp:91
const command_line::arg_descriptor< size_t > arg_block_download_max_size
Definition: cryptonote_core.cpp:117
epee::misc_utils::struct_init< core_stat_info_t > core_stat_info
Definition: cryptonote_stat_info.h:54
std::function< const epee::span< const unsigned char >cryptonote::network_type network)> GetCheckpointsCallback
Callback routine that returns checkpoints data for specific network type.
Definition: blockchain.h:89
void init_options(boost::program_options::options_description &hidden_options, boost::program_options::options_description &normal_options)
Definition: posix_daemonizer.inl:57
list_update_outcome
Definition: validators.h:61
mdb_size_t count(MDB_cursor *cur)
Definition: value_stream.cpp:39
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98
epee::misc_utils::struct_init< request_t > request
Definition: core_rpc_server_commands_defs.h:503
epee::misc_utils::struct_init< response_t > response
Definition: core_rpc_server_commands_defs.h:534
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:184
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:263
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:205
Definition: cryptonote_basic.h:453
Definition: verification_context.h:55
Definition: cryptonote_basic.h:410
Definition: cryptonote_core.h:956
bool & result
Definition: cryptonote_core.h:956
Definition: connection_context.h:42
Definition: cryptonote_protocol_handler_common.h:56
Definition: cryptonote_protocol_handler_common.h:43
Definition: cryptonote_core.h:57
const size_t long_term_block_weight_window
Definition: cryptonote_core.h:59
const std::pair< uint8_t, uint64_t > * hard_forks
Definition: cryptonote_core.h:58
Definition: core_rpc_server_commands_defs.h:1320
Definition: verification_context.h:39
Definition: core_rpc_server_commands_defs.h:1486
DISABLE_VS_WARNINGS(4244 4345 4503) using namespace crypto