Monero
Loading...
Searching...
No Matches
cryptonote_core.h
Go to the documentation of this file.
1// Copyright (c) 2014-2022, The Monero Project
2//
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without modification, are
6// permitted provided that the following conditions are met:
7//
8// 1. Redistributions of source code must retain the above copyright notice, this list of
9// conditions and the following disclaimer.
10//
11// 2. Redistributions in binary form must reproduce the above copyright notice, this list
12// of conditions and the following disclaimer in the documentation and/or other
13// materials provided with the distribution.
14//
15// 3. Neither the name of the copyright holder nor the names of its contributors may be
16// used to endorse or promote products derived from this software without specific
17// prior written permission.
18//
19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28//
29// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
30
31#pragma once
32
33#include <ctime>
34
35#include <boost/function.hpp>
36#include <boost/program_options/options_description.hpp>
37#include <boost/program_options/variables_map.hpp>
38
43#include "common/download.h"
44#include "common/command_line.h"
45#include "tx_pool.h"
46#include "blockchain.h"
49#include "warnings.h"
50#include "crypto/hash.h"
51#include "span.h"
52#include "rpc/fwd.h"
53
56
58
59namespace cryptonote
60{
61 struct test_options {
62 const std::pair<uint8_t, uint64_t> *hard_forks;
64 };
65
74
75 /************************************************************************/
76 /* */
77 /************************************************************************/
78
86 class core final: public i_miner_handler, public i_core_events
87 {
88 public:
89
97 core(i_cryptonote_protocol* pprotocol);
98
106
114 bool on_idle();
115
129 bool handle_incoming_tx(const blobdata& tx_blob, tx_verification_context& tvc, relay_method tx_relay, bool relayed);
130
151 bool handle_single_incoming_block(const blobdata& block_blob,
152 const block *b,
154 pool_supplement& extra_block_txs,
155 bool update_miner_blocktemplate = true);
156
179 bool handle_incoming_block(const blobdata& block_blob, const block *b,
181 bool update_miner_blocktemplate = true);
182
183 bool handle_incoming_block(const blobdata& block_blob, const block *b,
184 block_verification_context& bvc, pool_supplement& extra_block_txs,
185 bool update_miner_blocktemplate = true);
186
192 bool prepare_handle_incoming_blocks(const std::vector<block_complete_entry> &blocks_entry, std::vector<block> &blocks);
193
199 bool cleanup_handle_incoming_blocks(bool force_sync = false);
200
208 bool check_incoming_block_size(const blobdata& block_blob) const;
209
216
217 //-------------------- i_miner_handler -----------------------
218
231 virtual bool handle_block_found(block& b, block_verification_context &bvc) override;
232
238 virtual bool get_block_template(block& b, const account_public_address& adr, difficulty_type& diffic, uint64_t& height, uint64_t& expected_reward, const blobdata& ex_nonce, uint64_t &seed_height, crypto::hash &seed_hash) override;
239 virtual bool get_block_template(block& b, const crypto::hash *prev_block, const account_public_address& adr, difficulty_type& diffic, uint64_t& height, uint64_t& expected_reward, const blobdata& ex_nonce, uint64_t &seed_height, crypto::hash &seed_hash);
240
246 bool get_miner_data(uint8_t& major_version, uint64_t& height, crypto::hash& prev_id, crypto::hash& seed_hash, difficulty_type& difficulty, uint64_t& median_weight, uint64_t& already_generated_coins, std::vector<tx_block_template_backlog_entry>& tx_backlog);
247
253
254
261
267 const miner& get_miner()const{return m_miner;}
268
277 static void init_options(boost::program_options::options_description& desc);
278
292 bool init(const boost::program_options::variables_map& vm, const test_options *test_options = NULL, const GetCheckpointsCallback& get_checkpoints = nullptr, bool allow_dns = true);
293
299 bool set_genesis_block(const block& b);
300
308 bool deinit();
309
313 void test_drop_download();
314
321
327 bool get_test_drop_download() const;
328
338
345
352 void get_blockchain_top(uint64_t& height, crypto::hash& top_id) const;
353
359 bool get_blocks(uint64_t start_offset, size_t count, std::vector<std::pair<cryptonote::blobdata,block>>& blocks, std::vector<cryptonote::blobdata>& txs) const;
360
366 bool get_blocks(uint64_t start_offset, size_t count, std::vector<std::pair<cryptonote::blobdata,block>>& blocks) const;
367
373 bool get_blocks(uint64_t start_offset, size_t count, std::vector<block>& blocks) const;
374
380 template<class t_ids_container, class t_blocks_container, class t_missed_container>
381 bool get_blocks(const t_ids_container& block_ids, t_blocks_container& blocks, t_missed_container& missed_bs) const
382 {
383 return m_blockchain_storage.get_blocks(block_ids, blocks, missed_bs);
384 }
385
392
398 bool get_transactions(const std::vector<crypto::hash>& txs_ids, std::vector<cryptonote::blobdata>& txs, std::vector<crypto::hash>& missed_txs, bool pruned = false) const;
399
405 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;
406
412 bool get_transactions(const std::vector<crypto::hash>& txs_ids, std::vector<transaction>& txs, std::vector<crypto::hash>& missed_txs, bool pruned = false) const;
413
419 bool get_block_by_hash(const crypto::hash &h, block &blk, bool *orphan = NULL) const;
420
426 bool get_alternative_blocks(std::vector<block>& blocks) const;
427
433 size_t get_alternative_blocks_count() const;
434
441
447 const checkpoints& get_checkpoints() const;
448
454 void set_checkpoints(checkpoints&& chk_pts);
455
461 void set_checkpoints_file_path(const std::string& path);
462
468 void set_enforce_dns_checkpoints(bool enforce_dns);
469
475 void disable_dns_checkpoints(bool disable = true) { m_disable_dns_checkpoints = disable; }
476
482 bool pool_has_tx(const crypto::hash &txid) const;
483
490 bool get_pool_transactions(std::vector<transaction>& txs, bool include_sensitive_txes = false) const;
491
498 bool get_txpool_backlog(std::vector<tx_backlog_entry>& backlog, bool include_sensitive_txes = false) const;
499
506 bool get_pool_transaction_hashes(std::vector<crypto::hash>& txs, bool include_sensitive_txes = false) const;
507
514 bool get_pool_transactions_info(const std::vector<crypto::hash>& txids, std::vector<std::pair<crypto::hash, tx_memory_pool::tx_details>>& txs, bool include_sensitive_txes = false) const;
515
523 bool get_pool_info(time_t start_time, bool include_sensitive_txes, size_t max_tx_count, std::vector<std::pair<crypto::hash, tx_memory_pool::tx_details>>& added_txs, std::vector<crypto::hash>& remaining_added_txids, std::vector<crypto::hash>& removed_txs, bool& incremental) const;
524
531 bool get_pool_transaction_stats(struct txpool_stats& stats, bool include_sensitive_txes = false) const;
532
538 bool get_pool_transaction(const crypto::hash& id, cryptonote::blobdata& tx, relay_category tx_category) const;
539
546 bool get_pool_transactions_and_spent_keys_info(std::vector<tx_info>& tx_infos, std::vector<spent_key_image_info>& key_image_infos, bool include_sensitive_txes = false) const;
547
553 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;
554
561 size_t get_pool_transactions_count(bool include_sensitive_txes = false) const;
562
569
575 bool have_block_unlocked(const crypto::hash& id, int *where = NULL) const;
576 bool have_block(const crypto::hash& id, int *where = NULL) const;
577
583 bool get_short_chain_history(std::list<crypto::hash>& ids, uint64_t& current_height) const;
584
590 bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, bool clip_pruned, NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp) const;
591
597 bool find_blockchain_supplement(const uint64_t req_start_block, const std::list<crypto::hash>& qblock_ids, std::vector<std::pair<std::pair<cryptonote::blobdata, crypto::hash>, std::vector<std::pair<crypto::hash, cryptonote::blobdata> > > >& blocks, uint64_t& total_height, uint64_t& start_height, bool pruned, bool get_miner_tx_hash, size_t max_block_count, size_t max_tx_count) const;
598
604 bool get_tx_outputs_gindexs(const crypto::hash& tx_id, std::vector<uint64_t>& indexs) const;
605 bool get_tx_outputs_gindexs(const crypto::hash& tx_id, size_t n_txes, std::vector<std::vector<uint64_t>>& indexs) const;
606
613
620
627
633 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;
634
640 void pause_mine();
641
647 void resume_mine();
648
655
662
668 std::string print_pool(bool short_format) const;
669
675 virtual bool is_synchronized() const final;
676
682 void on_synchronized();
683
689 void safesyncmode(const bool onoff);
690
696 void set_target_blockchain_height(uint64_t target_blockchain_height);
697
704
711
718
725
732
737 std::time_t get_start_time() const;
738
749 bool update_checkpoints(const bool skip_dns = false);
750
757 void graceful_exit();
758
764 void stop();
765
771 bool is_key_image_spent(const crypto::key_image& key_im) const;
772
783 bool are_key_images_spent(const std::vector<crypto::key_image>& key_im, std::vector<bool> &spent) const;
784
793 bool are_key_images_spent_in_pool(const std::vector<crypto::key_image>& key_im, std::vector<bool> &spent) const;
794
800 size_t get_block_sync_size(uint64_t height) const;
801
807 std::pair<boost::multiprecision::uint128_t, boost::multiprecision::uint128_t> get_coinbase_tx_sum(const uint64_t start_offset, const size_t count);
808
814 network_type get_nettype() const { return m_nettype; };
815
825
831 uint64_t prevalidate_block_hashes(uint64_t height, const std::vector<crypto::hash> &hashes, const std::vector<uint64_t> &weights);
832
838 uint64_t get_free_space() const;
839
845 bool offline() const { return m_offline; }
846
853
861 bool prune_blockchain(uint32_t pruning_seed = 0);
862
869
876
883
887 bool has_block_weights(uint64_t height, uint64_t nblocks) const;
888
893
901 bool get_txpool_complement(const std::vector<crypto::hash> &hashes, std::vector<cryptonote::blobdata> &txes);
902
921 uint8_t hf_version);
922
931
940 static bool check_tx_inputs_ring_members_diff(const transaction& tx, const uint8_t hf_version);
941
951
952 private:
953
964 bool add_new_tx(transaction& tx, const crypto::hash& tx_hash, const cryptonote::blobdata &blob, size_t tx_weight, tx_verification_context& tvc, relay_method tx_relay, bool relayed);
965
980 bool add_new_tx(transaction& tx, tx_verification_context& tvc, relay_method tx_relay, bool relayed);
981
988 pool_supplement& extra_block_txs);
989
997 bool load_state_data();
998
1007
1015 bool handle_command_line(const boost::program_options::variables_map& vm);
1016
1023
1029 bool notify_txpool_event(const epee::span<const cryptonote::blobdata> tx_blobs, epee::span<const crypto::hash> tx_hashes, epee::span<const cryptonote::transaction> txs, const std::vector<bool> &just_broadcasted) const;
1030
1036 bool check_updates();
1037
1043 bool check_disk_space();
1044
1050 bool check_block_rate();
1051
1058
1060
1062
1065
1067
1069
1070 //m_miner and m_miner_addres are probably temporary here
1072
1073 std::string m_config_folder;
1074
1076
1084
1085 std::atomic<bool> m_starter_message_showed;
1086
1088
1090
1091 std::atomic<bool> m_update_available;
1092
1096
1097 std::atomic_flag m_checkpoints_updating;
1099
1101
1103
1104 enum {
1110
1113 boost::mutex m_update_mutex;
1114
1116
1117 std::shared_ptr<tools::Notify> m_block_rate_notify;
1118 };
1119}
1120
cryptonote::block b
Definition block.cpp:40
static uint64_t h
Definition blockchain_stats.cpp:55
Definition blockchain.h:103
A container for blockchain checkpoints.
Definition checkpoints.h:53
epee::math_helper::once_a_time_seconds< 60 *60 *5, true > m_blockchain_pruning_interval
interval for incremental blockchain pruning
Definition cryptonote_core.h:1082
size_t block_sync_size
Definition cryptonote_core.h:1100
static bool check_tx_inputs_keyimages_diff(const transaction &tx)
verify that each input key image in a transaction is unique
Definition cryptonote_core.cpp:1011
bool pool_has_tx(const crypto::hash &txid) const
checks if the pool has a transaction with the given hash
Definition cryptonote_core.cpp:1524
static bool check_tx_semantic(const transaction &tx, tx_verification_context &tvc, uint8_t hf_version)
validates some simple properties of a transaction
Definition cryptonote_core.cpp:823
bool check_updates()
checks DNS versions
Definition cryptonote_core.cpp:1622
void safesyncmode(const bool onoff)
Put DB in safe sync mode.
Definition cryptonote_core.cpp:1338
bool update_blockchain_pruning()
incrementally prunes blockchain
Definition cryptonote_core.cpp:1851
bool get_transactions(const std::vector< crypto::hash > &txs_ids, std::vector< cryptonote::blobdata > &txs, std::vector< crypto::hash > &missed_txs, bool pruned=false) const
Definition cryptonote_core.cpp:422
bool is_within_compiled_block_hash_area(uint64_t height) const
checks whether a given block height is included in the precompiled block hash area
Definition cryptonote_core.cpp:1893
bool m_offline
Definition cryptonote_core.h:1115
tx_memory_pool m_mempool
transaction pool instance
Definition cryptonote_core.h:1063
virtual void on_transactions_relayed(epee::span< const cryptonote::blobdata > tx_blobs, relay_method tx_relay) final
called when a transaction is relayed.
Definition cryptonote_core.cpp:1172
void get_blockchain_top(uint64_t &height, crypto::hash &top_id) const
get the hash and height of the most recent block
Definition cryptonote_core.cpp:397
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
Definition cryptonote_core.cpp:1544
size_t get_alternative_blocks_count() const
returns the number of alternative blocks stored
Definition cryptonote_core.cpp:448
uint64_t prevalidate_block_hashes(uint64_t height, const std::vector< crypto::hash > &hashes, const std::vector< uint64_t > &weights)
check a set of hashes against the precompiled hash set
Definition cryptonote_core.cpp:1871
void stop()
stops the daemon running
Definition cryptonote_core.cpp:297
epee::math_helper::once_a_time_seconds< 60 *60 *2, true > m_fork_moaner
interval for checking HardFork status
Definition cryptonote_core.h:1078
bool get_pool_transactions_info(const std::vector< crypto::hash > &txids, std::vector< std::pair< crypto::hash, tx_memory_pool::tx_details > > &txs, bool include_sensitive_txes=false) const
Definition cryptonote_core.cpp:1491
bool is_key_image_spent(const crypto::key_image &key_im) const
check if a key image is already spent on the blockchain
Definition cryptonote_core.cpp:920
bool has_block_weights(uint64_t height, uint64_t nblocks) const
checks whether block weights are known for the given range
Definition cryptonote_core.cpp:1898
void set_cryptonote_protocol(i_cryptonote_protocol *pprotocol)
set the pointer to the cryptonote protocol object to use
Definition cryptonote_core.cpp:241
uint8_t get_hard_fork_version(uint64_t height) const
return the hard fork version for a given block height
Definition cryptonote_core.cpp:1612
bool check_disk_space()
checks free disk space
Definition cryptonote_core.cpp:1752
static void init_options(boost::program_options::options_description &desc)
adds command line options to the given options set
Definition cryptonote_core.cpp:312
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:1079
bool get_test_drop_download_height() const
gets whether or not to drop blocks
Definition cryptonote_core.cpp:761
void pause_mine()
Definition cryptonote_core.cpp:1246
std::shared_ptr< tools::Notify > m_block_rate_notify
Definition cryptonote_core.h:1117
time_t m_last_json_checkpoints_update
time when json checkpoints were last updated
Definition cryptonote_core.h:1095
bool handle_command_line(const boost::program_options::variables_map &vm)
act on a set of command line options given
Definition cryptonote_core.cpp:347
bool update_miner_block_template()
Definition cryptonote_core.cpp:1564
void flush_invalid_blocks()
flushes the invalid block cache
Definition cryptonote_core.cpp:1841
const Blockchain & get_blockchain_storage() const
gets the Blockchain instance (const)
Definition cryptonote_core.h:661
void graceful_exit()
tells the daemon to wind down operations and stop running
Definition cryptonote_core.cpp:1908
epee::math_helper::once_a_time_seconds< 90, false > m_block_rate_interval
interval for checking block rate
Definition cryptonote_core.h:1081
void test_drop_download_height(uint64_t height)
sets to drop blocks downloaded below a certain height
Definition cryptonote_core.cpp:751
void resume_mine()
Definition cryptonote_core.cpp:1251
bool get_pool_info(time_t start_time, bool include_sensitive_txes, size_t max_tx_count, std::vector< std::pair< crypto::hash, tx_memory_pool::tx_details > > &added_txs, std::vector< crypto::hash > &remaining_added_txids, std::vector< crypto::hash > &removed_txs, bool &incremental) const
get info necessary for update of pool-related info in a wallet, preferably incremental
Definition cryptonote_core.cpp:1508
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
Definition cryptonote_core.cpp:976
bool on_idle()
calls various idle routines
Definition cryptonote_core.cpp:1570
uint64_t get_free_space() const
get free disk space on the blockchain partition
Definition cryptonote_core.cpp:1876
uint32_t get_blockchain_pruning_seed() const
get the blockchain pruning seed
Definition cryptonote_core.cpp:1883
network_type m_nettype
which network are we on?
Definition cryptonote_core.h:1089
difficulty_type get_block_cumulative_difficulty(uint64_t height) const
Definition cryptonote_core.cpp:1471
bool get_pool_transaction_hashes(std::vector< crypto::hash > &txs, bool include_sensitive_txes=false) const
get a list of all transactions in the pool
Definition cryptonote_core.cpp:1502
bool is_update_available() const
check whether an update is known to be available or not
Definition cryptonote_core.h:824
bool get_short_chain_history(std::list< crypto::hash > &ids, uint64_t &current_height) const
gets the hashes for a subset of the blockchain
Definition cryptonote_core.cpp:1539
miner m_miner
miner instance
Definition cryptonote_core.h:1071
Blockchain m_blockchain_storage
Blockchain instance.
Definition cryptonote_core.h:1064
bool have_block(const crypto::hash &id, int *where=NULL) const
Definition cryptonote_core.cpp:1486
bool get_pool_transactions(std::vector< transaction > &txs, bool include_sensitive_txes=false) const
get a list of all transactions in the pool
Definition cryptonote_core.cpp:1496
std::string m_config_folder
folder to look in for configs and other files
Definition cryptonote_core.h:1073
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
Definition cryptonote_core.cpp:1349
bool check_block_rate()
checks block rate, and warns if it's too slow
Definition cryptonote_core.cpp:1795
uint64_t m_target_blockchain_height
blockchain height target
Definition cryptonote_core.h:1087
bool set_genesis_block(const block &b)
clears the blockchain and starts a new one
Definition cryptonote_core.cpp:727
size_t get_blockchain_total_transactions() const
gets the total number of transactions on the main chain
Definition cryptonote_core.cpp:1061
bool have_block_unlocked(const crypto::hash &id, int *where=NULL) const
Definition cryptonote_core.cpp:1481
bool add_new_block(const block &b, block_verification_context &bvc, pool_supplement &extra_block_txs)
adds a block to the blockchain
Definition cryptonote_core.cpp:1343
@ UPDATES_NOTIFY
Definition cryptonote_core.h:1106
@ UPDATES_UPDATE
Definition cryptonote_core.h:1108
@ UPDATES_DOWNLOAD
Definition cryptonote_core.h:1107
@ UPDATES_DISABLED
Definition cryptonote_core.h:1105
uint8_t get_ideal_hard_fork_version() const
returns the newest hardfork version known to the blockchain
Definition cryptonote_core.cpp:1602
crypto::hash get_tail_id() const
get the hash of the most recent block on the blockchain
Definition cryptonote_core.cpp:1466
bool get_test_drop_download() const
gets whether or not to drop blocks (for testing)
Definition cryptonote_core.cpp:756
bool m_disable_dns_checkpoints
Definition cryptonote_core.h:1098
bool cleanup_handle_incoming_blocks(bool force_sync=false)
incoming blocks post-processing, cleanup, and disk sync
Definition cryptonote_core.cpp:1361
virtual uint64_t get_current_blockchain_height() const final
get the current height of the blockchain
Definition cryptonote_core.cpp:392
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:1097
virtual bool is_synchronized() const final
gets the core synchronization status
Definition cryptonote_core.cpp:1328
std::string m_checkpoints_path
path to json checkpoints file
Definition cryptonote_core.h:1093
bool load_state_data()
load any core state stored on disk
Definition cryptonote_core.cpp:732
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:1077
void set_checkpoints_file_path(const std::string &path)
set the file path to read from when loading checkpoints
Definition cryptonote_core.cpp:258
bool check_blockchain_pruning()
checks the blockchain pruning if enabled
Definition cryptonote_core.cpp:1856
size_t get_block_sync_size(uint64_t height) const
get the number of blocks to sync in one go
Definition cryptonote_core.cpp:935
bool offline() const
get whether the core is running offline
Definition cryptonote_core.h:845
bool notify_txpool_event(const epee::span< const cryptonote::blobdata > tx_blobs, epee::span< const crypto::hash > tx_hashes, epee::span< const cryptonote::transaction > txs, const std::vector< bool > &just_broadcasted) const
sends notification of txpool events to subscribers
Definition cryptonote_core.cpp:1142
bool deinit()
performs safe shutdown steps for core and core components
Definition cryptonote_core.cpp:738
network_type get_nettype() const
get the network type we're on
Definition cryptonote_core.h:814
core(i_cryptonote_protocol *pprotocol)
constructor
Definition cryptonote_core.cpp:222
virtual bool get_block_template(block &b, const account_public_address &adr, difficulty_type &diffic, uint64_t &height, uint64_t &expected_reward, const blobdata &ex_nonce, uint64_t &seed_height, crypto::hash &seed_hash) override
creates a new block to mine against
Definition cryptonote_core.cpp:1201
const miner & get_miner() const
gets the miner instance (const)
Definition cryptonote_core.h:267
std::time_t get_start_time() const
gets start_time
Definition cryptonote_core.cpp:1903
uint64_t m_test_drop_download_height
height under which to drop incoming blocks, if doing so
Definition cryptonote_core.h:1061
bool handle_single_incoming_block(const blobdata &block_blob, const block *b, block_verification_context &bvc, pool_supplement &extra_block_txs, bool update_miner_blocktemplate=true)
handles a single incoming block
Definition cryptonote_core.cpp:1417
void set_checkpoints(checkpoints &&chk_pts)
assign a set of blockchain checkpoint hashes
Definition cryptonote_core.cpp:253
std::string print_pool(bool short_format) const
get a string containing human-readable pool information
Definition cryptonote_core.cpp:1559
size_t get_pool_transactions_count(bool include_sensitive_txes=false) const
get the total number of transactions in the pool
Definition cryptonote_core.cpp:1476
bool handle_incoming_block(const blobdata &block_blob, const block *b, block_verification_context &bvc, bool update_miner_blocktemplate=true)
handles an incoming block as part of a batch
Definition cryptonote_core.cpp:1373
std::atomic< bool > m_starter_message_showed
has the "daemon will sync now" message been shown?
Definition cryptonote_core.h:1085
static bool check_tx_inputs_ring_members_diff(const transaction &tx, const uint8_t hf_version)
verify that each ring uses distinct members
Definition cryptonote_core.cpp:1023
void set_target_blockchain_height(uint64_t target_blockchain_height)
sets the target blockchain height
Definition cryptonote_core.cpp:1861
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
Definition cryptonote_core.cpp:1226
crypto::hash get_block_id_by_height(uint64_t height) const
gets a block's hash given a height
Definition cryptonote_core.cpp:1549
bool get_pool_transaction(const crypto::hash &id, cryptonote::blobdata &tx, relay_category tx_category) const
get a specific transaction from the pool
Definition cryptonote_core.cpp:1519
bool update_checkpoints(const bool skip_dns=false)
tells the Blockchain to update its checkpoints
Definition cryptonote_core.cpp:268
i_cryptonote_protocol * get_protocol()
get the cryptonote protocol instance
Definition cryptonote_core.h:215
uint64_t get_target_blockchain_height() const
gets the target blockchain height
Definition cryptonote_core.cpp:1866
void on_synchronized()
Definition cryptonote_core.cpp:1333
bool get_alternative_blocks(std::vector< block > &blocks) const
compiles a list of all blocks stored as alternative chains
Definition cryptonote_core.cpp:443
bool recalculate_difficulties()
recalculate difficulties after the last difficulty checklpoint to circumvent the annoying 'difficulty...
Definition cryptonote_core.cpp:1835
tools::download_async_handle m_update_download
Definition cryptonote_core.h:1111
void set_enforce_dns_checkpoints(bool enforce_dns)
set whether or not we enforce DNS checkpoints
Definition cryptonote_core.cpp:263
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
Definition cryptonote_core.cpp:427
bool m_test_drop_download
whether or not to drop incoming blocks (for testing)
Definition cryptonote_core.h:1059
bool check_incoming_block_size(const blobdata &block_blob) const
check the size of a block against the current maximum
Definition cryptonote_core.cpp:1452
void disable_dns_checkpoints(bool disable=true)
set whether or not to enable or disable DNS checkpoints
Definition cryptonote_core.h:475
epee::critical_section m_incoming_tx_lock
incoming transaction lock
Definition cryptonote_core.h:1068
std::atomic< bool > m_update_available
Definition cryptonote_core.h:1091
epee::math_helper::once_a_time_seconds< 60 *60 *24 *7, false > m_diff_recalc_interval
interval for recalculating difficulties
Definition cryptonote_core.h:1083
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
Definition cryptonote_core.cpp:1534
bool get_pool_transaction_stats(struct txpool_stats &stats, bool include_sensitive_txes=false) const
get a list of all transactions in the pool
Definition cryptonote_core.cpp:1513
bool find_blockchain_supplement(const std::list< crypto::hash > &qblock_ids, bool clip_pruned, NOTIFY_RESPONSE_CHAIN_ENTRY::request &resp) const
Definition cryptonote_core.cpp:1216
void test_drop_download()
sets to drop blocks downloaded (for testing)
Definition cryptonote_core.cpp:746
bool get_blocks(uint64_t start_offset, size_t count, std::vector< std::pair< cryptonote::blobdata, block > > &blocks, std::vector< cryptonote::blobdata > &txs) const
Definition cryptonote_core.cpp:402
size_t m_last_update_length
Definition cryptonote_core.h:1112
bool get_pool_transactions_and_spent_keys_info(std::vector< tx_info > &tx_infos, std::vector< spent_key_image_info > &key_image_infos, bool include_sensitive_txes=false) const
Definition cryptonote_core.cpp:1529
bool get_txpool_complement(const std::vector< crypto::hash > &hashes, std::vector< cryptonote::blobdata > &txes)
returns the set of transactions in the txpool which are not in the argument
Definition cryptonote_core.cpp:1846
bool prune_blockchain(uint32_t pruning_seed=0)
prune the blockchain
Definition cryptonote_core.cpp:1888
uint64_t get_earliest_ideal_height_for_version(uint8_t version) const
return the earliest block a given version may activate
Definition cryptonote_core.cpp:1617
bool get_block_by_hash(const crypto::hash &h, block &blk, bool *orphan=NULL) const
gets the block with a given hash
Definition cryptonote_core.cpp:1554
i_cryptonote_protocol * m_pprotocol
cryptonote protocol instance
Definition cryptonote_core.h:1066
cryptonote_protocol_stub m_protocol_stub
cryptonote protocol stub instance
Definition cryptonote_core.h:1075
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
Definition cryptonote_core.cpp:925
static bool check_tx_inputs_keyimages_domain(const transaction &tx)
verify that each input key image in a transaction is in the valid domain
Definition cryptonote_core.cpp:1038
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:1080
boost::mutex m_update_mutex
Definition cryptonote_core.h:1113
enum cryptonote::core::@176231357257140137215223266231333145057172114107 check_updates_level
bool get_txpool_backlog(std::vector< tx_backlog_entry > &backlog, bool include_sensitive_txes=false) const
Definition cryptonote_core.cpp:432
Blockchain & get_blockchain_storage()
gets the Blockchain instance
Definition cryptonote_core.h:654
time_t start_time
Definition cryptonote_core.h:1102
virtual bool handle_block_found(block &b, block_verification_context &bvc) override
stores and relays a block found by a miner
Definition cryptonote_core.cpp:1270
time_t m_last_dns_checkpoints_update
time when dns checkpoints were last updated
Definition cryptonote_core.h:1094
const checkpoints & get_checkpoints() const
get a set of blockchain checkpoint hashes
Definition cryptonote_core.cpp:249
bool handle_incoming_tx(const blobdata &tx_blob, tx_verification_context &tvc, relay_method tx_relay, bool relayed)
handles an incoming transaction
Definition cryptonote_core.cpp:772
bool add_new_tx(transaction &tx, const crypto::hash &tx_hash, const cryptonote::blobdata &blob, size_t tx_weight, tx_verification_context &tvc, relay_method tx_relay, bool relayed)
Definition cryptonote_core.cpp:1066
bool relay_txpool_transactions()
attempts to relay any transactions in the mempool which need it
Definition cryptonote_core.cpp:1097
miner & get_miner()
gets the miner instance
Definition cryptonote_core.h:260
std::pair< boost::multiprecision::uint128_t, boost::multiprecision::uint128_t > get_coinbase_tx_sum(const uint64_t start_offset, const size_t count)
get the sum of coinbase tx amounts between blocks
Definition cryptonote_core.cpp:983
bool get_miner_data(uint8_t &major_version, uint64_t &height, crypto::hash &prev_id, crypto::hash &seed_hash, difficulty_type &difficulty, uint64_t &median_weight, uint64_t &already_generated_coins, std::vector< tx_block_template_backlog_entry > &tx_backlog)
gets data required to create a block template and start mining on it
Definition cryptonote_core.cpp:1211
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
Definition cryptonote_core.cpp:1236
Definition miner.h:61
Definition cryptonote_basic.h:205
Transaction pool, handles transactions which are not part of a block.
Definition tx_pool.h:99
Definition syncobj.h:82
Definition math_helper.h:297
Non-owning sequence of data. Does not deep copy.
Definition span.h:55
@ HAVE_BLOCK_MAIN_CHAIN
Definition cryptonote_core.h:57
@ HAVE_BLOCK_INVALID
Definition cryptonote_core.h:57
@ HAVE_BLOCK_ALT_CHAIN
Definition cryptonote_core.h:57
#define false
const char * res
Definition hmac_keccak.cpp:42
#define const
Definition ipfrdr.c:80
static void init()
Definition logging.cpp:42
static int version
Definition mdb_load.c:29
Definition base.py:1
Definition blocks.cpp:13
Definition portable_binary_archive.hpp:29
crypto namespace.
Definition crypto.cpp:60
POD_CLASS hash
Definition hash.h:49
std::unordered_map< crypto::key_image, std::vector< crypto::hash > > key_images_with_tx_hashes
Definition message_data_structs.h:107
Holds cryptonote related classes and helpers.
Definition blockchain_db.cpp:45
const command_line::arg_descriptor< bool > arg_sync_pruned_blocks
Definition cryptonote_core.cpp:126
const command_line::arg_descriptor< std::string, false, true, 2 > arg_data_dir
Definition cryptonote_core.cpp:100
boost::multiprecision::uint128_t difficulty_type
Definition difficulty.h:41
network_type
Definition cryptonote_config.h:302
const command_line::arg_descriptor< bool > arg_regtest_on
Definition cryptonote_core.cpp:85
const command_line::arg_descriptor< bool > arg_offline
Definition cryptonote_core.cpp:113
relay_category
Definition blockchain_db.h:110
relay_method
Methods tracking how a tx was received and relayed.
Definition enums.h:37
const command_line::arg_descriptor< difficulty_type > arg_fixed_difficulty
Definition cryptonote_core.cpp:95
const command_line::arg_descriptor< bool, false > arg_testnet_on
Definition cryptonote_core.cpp:75
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:93
const command_line::arg_descriptor< bool, false > arg_stagenet_on
Definition cryptonote_core.cpp:80
std::string blobdata
Definition blobdatatype.h:39
const command_line::arg_descriptor< size_t > arg_block_download_max_size
Definition cryptonote_core.cpp:121
Definition get_output_distribution.py:1
Definition enums.h:68
std::shared_ptr< download_thread_control > download_async_handle
Definition download.h:36
unsigned int uint32_t
Definition stdint.h:126
unsigned char uint8_t
Definition stdint.h:124
unsigned __int64 uint64_t
Definition stdint.h:136
Definition command_line.h:53
epee::misc_utils::struct_init< request_t > request
Definition core_rpc_server_commands_defs.h:539
epee::misc_utils::struct_init< response_t > response
Definition core_rpc_server_commands_defs.h:567
epee::misc_utils::struct_init< request_t > request
Definition cryptonote_protocol_defs.h:227
epee::misc_utils::struct_init< request_t > request
Definition cryptonote_protocol_defs.h:316
epee::misc_utils::struct_init< request_t > request
Definition cryptonote_protocol_defs.h:246
Definition cryptonote_basic.h:512
Definition verification_context.h:66
Definition cryptonote_basic.h:475
Definition connection_context.h:44
Definition cryptonote_protocol_handler_common.h:53
Definition i_core_events.h:38
Definition cryptonote_protocol_handler_common.h:42
Definition miner.h:48
Used to provide transaction info that skips the mempool to block handling code.
Definition tx_verification_utils.h:101
Definition cryptonote_core.h:61
const size_t long_term_block_weight_window
Definition cryptonote_core.h:63
const std::pair< uint8_t, uint64_t > * hard_forks
Definition cryptonote_core.h:62
Definition verification_context.h:41
Definition core_rpc_server_commands_defs.h:1681
struct hash_func hashes[]
randomx_vm * vm
Definition tests.cpp:20
cryptonote::transaction tx
Definition transaction.cpp:40
#define DISABLE_VS_WARNINGS(w)
Definition warnings.h:18
#define POP_WARNINGS
Definition warnings.h:17
#define PUSH_WARNINGS
Definition warnings.h:16