Monero
Loading...
Searching...
No Matches
blockchain.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#include <boost/asio/io_service.hpp>
33#include <boost/function/function_fwd.hpp>
34#if BOOST_VERSION >= 107400
35#include <boost/serialization/library_version_type.hpp>
36#endif
37#include <boost/serialization/serialization.hpp>
38#include <boost/serialization/version.hpp>
39#include <boost/serialization/list.hpp>
40#include <boost/multi_index_container.hpp>
41#include <boost/multi_index/global_fun.hpp>
42#include <boost/multi_index/hashed_index.hpp>
43#include <boost/multi_index/member.hpp>
44#include <atomic>
45#include <functional>
46#include <unordered_map>
47#include <unordered_set>
48
49#include "span.h"
50#include "syncobj.h"
51#include "string_tools.h"
52#include "rolling_median.h"
54#include "common/powerof.h"
55#include "common/util.h"
59#include "cryptonote_tx_utils.h"
61#include "crypto/hash.h"
65
66namespace tools { class Notify; }
67
68namespace cryptonote
69{
70 class tx_memory_pool;
71 struct test_options;
72
77 {
82 };
83
91 typedef std::function<const epee::span<const unsigned char>(cryptonote::network_type network)> GetCheckpointsCallback;
92
93 typedef boost::function<void(uint64_t /* height */, epee::span<const block> /* blocks */)> BlockNotifyCallback;
94 typedef boost::function<void(uint8_t /* major_version */, uint64_t /* height */, const crypto::hash& /* prev_id */, const crypto::hash& /* seed_hash */, difficulty_type /* diff */, uint64_t /* median_weight */, uint64_t /* already_generated_coins */, const std::vector<tx_block_template_backlog_entry>& /* tx_backlog */)> MinerNotifyCallback;
95
96 /************************************************************************/
97 /* */
98 /************************************************************************/
100 {
101 public:
106 {
112 };
113
119 Blockchain(tx_memory_pool& tx_pool);
120
124 ~Blockchain();
125
138 bool init(BlockchainDB* db, const network_type nettype = MAINNET, bool offline = false, const cryptonote::test_options *test_options = NULL, difficulty_type fixed_difficulty = 0, const GetCheckpointsCallback& get_checkpoints = nullptr);
139
150 bool init(BlockchainDB* db, HardFork*& hf, const network_type nettype = MAINNET, bool offline = false);
151
159 bool deinit();
160
166 const checkpoints& get_checkpoints() const { return m_checkpoints; }
167
173 void set_checkpoints(checkpoints&& chk_pts) { m_checkpoints = chk_pts; }
174
185 bool get_blocks(uint64_t start_offset, size_t count, std::vector<std::pair<cryptonote::blobdata,block>>& blocks, std::vector<cryptonote::blobdata>& txs) const;
186
196 bool get_blocks(uint64_t start_offset, size_t count, std::vector<std::pair<cryptonote::blobdata,block>>& blocks) const;
197
205 bool get_alternative_blocks(std::vector<block>& blocks) const;
206
212 size_t get_alternative_blocks_count() const;
213
221 crypto::hash get_block_id_by_height(uint64_t height) const;
222
233 crypto::hash get_pending_block_id_by_height(uint64_t height) const;
234
244 bool get_block_by_hash(const crypto::hash &h, block &blk, bool *orphan = NULL) const;
245
254 bool prepare_handle_incoming_blocks(const std::vector<block_complete_entry> &blocks_entry, std::vector<block> &blocks);
255
263 bool cleanup_handle_incoming_blocks(bool force_sync = false);
264
272 bool have_tx(const crypto::hash &id) const;
273
281 bool have_tx_keyimges_as_spent(const transaction &tx) const;
282
295 bool have_tx_keyimg_as_spent(const crypto::key_image &key_im) const;
296
303
310
318 crypto::hash get_tail_id(uint64_t& height) const;
319
326
332 std::pair<bool, uint64_t> check_difficulty_checkpoints() const;
333
341 size_t recalculate_difficulties(boost::optional<uint64_t> start_height = boost::none);
342
356 bool add_new_block(const block& bl_, block_verification_context& bvc);
357
366
380 bool create_block_template(block& b, const account_public_address& miner_address, difficulty_type& di, uint64_t& height, uint64_t& expected_reward, const blobdata& ex_nonce, uint64_t &seed_height, crypto::hash &seed_hash);
381 bool create_block_template(block& b, const crypto::hash *from_block, const account_public_address& miner_address, difficulty_type& di, uint64_t& height, uint64_t& expected_reward, const blobdata& ex_nonce, uint64_t &seed_height, crypto::hash &seed_hash);
382
397 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);
398
410 bool have_block_unlocked(const crypto::hash& id, int *where = NULL) const;
411 bool have_block(const crypto::hash& id, int *where = NULL) const;
412
418 size_t get_total_transactions() const;
419
434 bool get_short_chain_history(std::list<crypto::hash>& ids) const;
435
452 bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, std::vector<crypto::hash>& hashes, std::vector<uint64_t>* weights, uint64_t& start_height, uint64_t& current_height, bool clip_pruned) const;
453
467 bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, bool clip_pruned, NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp) const;
468
481 bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, uint64_t& starter_offset) const;
482
501 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;
502
516
524 uint64_t get_num_mature_outputs(uint64_t amount) const;
525
534 crypto::public_key get_output_key(uint64_t amount, uint64_t global_index) const;
535
550
560 void get_output_key_mask_unlocked(const uint64_t& amount, const uint64_t& index, crypto::public_key& key, rct::key& mask, bool& unlocked) const;
561
572 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;
573
586 bool get_tx_outputs_gindexs(const crypto::hash& tx_id, std::vector<uint64_t>& indexs) const;
587 bool get_tx_outputs_gindexs(const crypto::hash& tx_id, size_t n_txes, std::vector<std::vector<uint64_t>>& indexs) const;
588
597 bool store_blockchain();
598
615 bool check_tx_inputs(transaction& tx, uint64_t& pmax_used_block_height, crypto::hash& max_used_block_id, tx_verification_context &tvc, bool kept_by_block = false) const;
616
625 {
627 }
628
642 static uint64_t get_dynamic_base_fee(uint64_t block_reward, size_t median_block_weight, uint8_t version);
643
657 uint64_t get_dynamic_base_fee_estimate(uint64_t grace_blocks) const;
658 void get_dynamic_base_fee_estimate_2021_scaling(uint64_t grace_blocks, uint64_t base_reward, uint64_t Mnw, uint64_t Mlw, std::vector<uint64_t> &fees) const;
659
673 void get_dynamic_base_fee_estimate_2021_scaling(uint64_t grace_blocks, std::vector<uint64_t> &fees) const;
674
687 bool check_fee(size_t tx_weight, uint64_t fee) const;
688
702
709
716
723
731 difficulty_type block_difficulty(uint64_t i) const;
732
745 template<class t_ids_container, class t_blocks_container, class t_missed_container>
746 bool get_blocks(const t_ids_container& block_ids, t_blocks_container& blocks, t_missed_container& missed_bs) const;
747
761 bool get_transactions_blobs(const std::vector<crypto::hash>& txs_ids, std::vector<cryptonote::blobdata>& txs, std::vector<crypto::hash>& missed_txs, bool pruned = false) const;
762 bool get_transactions_blobs(const std::vector<crypto::hash>& txs_ids, std::vector<tx_blob_entry>& txs, std::vector<crypto::hash>& missed_txs, bool pruned = false) const;
763 template<class t_ids_container, class t_tx_container, class t_missed_container>
764 bool get_split_transactions_blobs(const t_ids_container& txs_ids, t_tx_container& txs, t_missed_container& missed_txs) const;
765 template<class t_ids_container, class t_tx_container, class t_missed_container>
766 bool get_transactions(const t_ids_container& txs_ids, t_tx_container& txs, t_missed_container& missed_txs, bool pruned = false) const;
767
768 //debug functions
769
781 void check_against_checkpoints(const checkpoints& points, bool enforce);
782
788 void set_enforce_dns_checkpoints(bool enforce);
789
798 bool update_checkpoints(const std::string& file_path, bool check_dns);
799
800
801 // user options, must be called before calling init()
802
812 void set_user_options(uint64_t maxthreads, bool sync_on_blocks, uint64_t sync_threshold,
813 blockchain_db_sync_mode sync_mode, bool fast_sync);
814
821
828
834 void set_reorg_notify(const std::shared_ptr<tools::Notify> &notify) { m_reorg_notify = notify; }
835
839 void safesyncmode(const bool onoff);
840
846 void set_show_time_stats(bool stats) { m_show_time_stats = stats; }
847
854
861
868
875
884 uint8_t get_ideal_hard_fork_version(uint64_t height) const { return m_hardfork->get_ideal_version(height); }
885
893 uint8_t get_hard_fork_version(uint64_t height) const { return m_hardfork->get(height); }
894
901
907 const std::vector<hardfork_t>& get_hardforks() const { return m_hardfork->get_hardforks(); }
908
921 bool get_hard_fork_voting_info(uint8_t version, uint32_t &window, uint32_t &votes, uint32_t &threshold, uint64_t &earliest_height, uint8_t &voting) const;
922
929
937 bool flush_txes_from_pool(const std::vector<crypto::hash> &txids);
938
949 std::map<uint64_t, std::tuple<uint64_t, uint64_t, uint64_t>> get_output_histogram(const std::vector<uint64_t> &amounts, bool unlocked, uint64_t recent_cutoff, uint64_t min_count = 0) const;
950
958 bool for_all_key_images(std::function<bool(const crypto::key_image&)>) const;
959
969 bool for_blocks_range(const uint64_t& h1, const uint64_t& h2, std::function<bool(uint64_t, const crypto::hash&, const block&)>) const;
970
979 bool for_all_transactions(std::function<bool(const crypto::hash&, const cryptonote::transaction&)>, bool pruned) const;
980
988 bool for_all_outputs(std::function<bool(uint64_t amount, const crypto::hash &tx_hash, uint64_t height, size_t tx_idx)>) const;
989
998 bool for_all_outputs(uint64_t amount, std::function<bool(uint64_t height)>) const;
999
1005 const BlockchainDB& get_db() const
1006 {
1007 return *m_db;
1008 }
1009
1016 {
1017 return *m_db;
1018 }
1019
1027 void output_scan_worker(const uint64_t amount,const std::vector<uint64_t> &offsets,
1028 std::vector<output_data_t> &outputs) const;
1029
1037 void block_longhash_worker(uint64_t height, const epee::span<const block> &blocks,
1038 std::unordered_map<crypto::hash, crypto::hash> &map) const;
1039
1045 std::vector<std::pair<block_extended_info,std::vector<crypto::hash>>> get_alternative_chains() const;
1046
1047 void add_txpool_tx(const crypto::hash &txid, const cryptonote::blobdata &blob, const txpool_tx_meta_t &meta);
1048 void update_txpool_tx(const crypto::hash &txid, const txpool_tx_meta_t &meta);
1049 void remove_txpool_tx(const crypto::hash &txid);
1050 uint64_t get_txpool_tx_count(bool include_sensitive = false) const;
1051 bool get_txpool_tx_meta(const crypto::hash& txid, txpool_tx_meta_t &meta) const;
1052 bool get_txpool_tx_blob(const crypto::hash& txid, cryptonote::blobdata &bd, relay_category tx_category) const;
1054 bool for_all_txpool_txes(std::function<bool(const crypto::hash&, const txpool_tx_meta_t&, const cryptonote::blobdata_ref*)>, bool include_blob = false, relay_category tx_category = relay_category::broadcasted) const;
1055 bool txpool_tx_matches_category(const crypto::hash& tx_hash, relay_category category);
1056
1058 uint64_t prevalidate_block_hashes(uint64_t height, const std::vector<crypto::hash> &hashes, const std::vector<uint64_t> &weights);
1060 bool prune_blockchain(uint32_t pruning_seed = 0);
1063
1064 void lock();
1065 void unlock();
1066
1067 void cancel();
1068
1075
1079 std::vector<time_t> get_last_block_timestamps(unsigned int blocks) const;
1080
1086 void pop_blocks(uint64_t nblocks);
1087
1093 bool is_within_compiled_block_hash_area(uint64_t height) const;
1094
1101 bool has_block_weights(uint64_t height, uint64_t nblocks) const;
1102
1106 void flush_invalid_blocks();
1107
1121 uint64_t get_adjusted_time(uint64_t height) const;
1122
1123#ifndef IN_UNIT_TESTS
1124 private:
1125#endif
1126
1127 // TODO: evaluate whether or not each of these typedefs are left over from blockchain_storage
1128 typedef std::unordered_set<crypto::key_image> key_images_container;
1129
1130 typedef std::vector<block_extended_info> blocks_container;
1131
1132 typedef std::unordered_map<crypto::hash, block_extended_info> blocks_ext_by_hash;
1133
1134
1136
1138
1139 mutable epee::critical_section m_blockchain_lock; // TODO: add here reader/writer lock
1140
1141 // main chain
1144
1145 // metadata containers
1146 std::unordered_map<crypto::hash, std::unordered_map<crypto::key_image, std::vector<output_data_t>>> m_scan_table;
1147 std::unordered_map<crypto::hash, crypto::hash> m_blocks_longhash_table;
1148
1149 // Keccak hashes for each block and for fast pow checking
1150 std::vector<std::pair<crypto::hash, crypto::hash>> m_blocks_hash_of_hashes;
1151 std::vector<std::pair<crypto::hash, uint64_t>> m_blocks_hash_check;
1152 std::vector<crypto::hash> m_blocks_txs_check;
1153
1165 std::vector<uint64_t> m_timestamps;
1166 std::vector<difficulty_type> m_difficulties;
1173
1177
1178 boost::asio::io_service m_async_service;
1179 boost::thread_group m_async_pool;
1180 std::unique_ptr<boost::asio::io_service::work> m_async_work_idle;
1181
1182 // some invalid blocks
1183 blocks_ext_by_hash m_invalid_blocks; // crypto::hash -> block_extended_info
1184
1185
1188
1190
1194
1195 std::atomic<bool> m_cancel;
1196
1197 // block template cache
1208
1209
1211
1212 /* `boost::function` is used because the implementation never allocates if
1213 the callable object has a single `std::shared_ptr` or `std::weap_ptr`
1214 internally. Whereas, the libstdc++ `std::function` will allocate. */
1215
1216 std::vector<BlockNotifyCallback> m_block_notifiers;
1217 std::vector<MinerNotifyCallback> m_miner_notifiers;
1218 std::shared_ptr<tools::Notify> m_reorg_notify;
1219
1220 // for prepare_handle_incoming_blocks
1223 std::vector<block> *m_prepare_blocks;
1224
1244 template<class visitor_t>
1245 inline bool scan_outputkeys_for_indexes(size_t tx_version, const txin_to_key& tx_in_to_key, visitor_t &vis, const crypto::hash &tx_prefix_hash, uint64_t* pmax_related_block_height = NULL) const;
1246
1268 bool check_tx_input(size_t tx_version,const txin_to_key& txin, const crypto::hash& tx_prefix_hash, const std::vector<crypto::signature>& sig, const rct::rctSig &rct_signatures, std::vector<rct::ctkey> &output_keys, uint64_t* pmax_related_block_height, uint8_t hf_version) const;
1269
1290 bool check_tx_inputs(transaction& tx, tx_verification_context &tvc, uint64_t* pmax_used_block_height = NULL) const;
1291
1304 bool switch_to_alternative_blockchain(std::list<block_extended_info>& alt_chain, bool discard_disconnected_chain);
1305
1312
1326 bool handle_block_to_main_chain(const block& bl, block_verification_context& bvc, bool notify = true);
1327
1342 bool handle_block_to_main_chain(const block& bl, const crypto::hash& id, block_verification_context& bvc, bool notify = true);
1343
1358
1369 bool build_alt_chain(const crypto::hash &prev_id, std::list<block_extended_info>& alt_chain, std::vector<uint64_t> &timestamps, block_verification_context& bvc) const;
1370
1379 difficulty_type get_next_difficulty_for_alternative_chain(const std::list<block_extended_info>& alt_chain, block_extended_info& bei) const;
1380
1393 bool prevalidate_miner_transaction(const block& b, uint64_t height, uint8_t hf_version);
1394
1411 bool validate_miner_transaction(const block& b, size_t cumulative_block_weight, uint64_t fee, uint64_t& base_reward, uint64_t already_generated_coins, bool &partial_block_reward, uint8_t version);
1412
1425 bool rollback_blockchain_switching(std::list<block>& original_chain, uint64_t rollback_height);
1426
1435 void get_last_n_blocks_weights(std::vector<uint64_t>& weights, size_t count) const;
1436
1447 uint64_t get_long_term_block_weight_median(uint64_t start_height, size_t count) const;
1448
1460 bool is_tx_spendtime_unlocked(uint64_t unlock_time, uint8_t hf_version) const;
1461
1473 bool add_block_as_invalid(const block& bl, const crypto::hash& h);
1474
1486 bool add_block_as_invalid(const block_extended_info& bei, const crypto::hash& h);
1487
1504 bool check_block_timestamp(const block& b, uint64_t& median_ts) const;
1505 bool check_block_timestamp(const block& b) const { uint64_t median_ts; return check_block_timestamp(b, median_ts); }
1506
1518 bool check_block_timestamp(std::vector<uint64_t>& timestamps, const block& b, uint64_t& median_ts) const;
1519 bool check_block_timestamp(std::vector<uint64_t>& timestamps, const block& b) const { uint64_t median_ts; return check_block_timestamp(timestamps, b, median_ts); }
1520
1532 bool complete_timestamps_vector(uint64_t start_height, std::vector<uint64_t>& timestamps) const;
1533
1541 bool update_next_cumulative_weight_limit(uint64_t *long_term_effective_median_block_weight = NULL);
1542 void return_tx_to_pool(std::vector<std::pair<transaction, blobdata>> &txs);
1543
1552 bool check_for_double_spend(const transaction& tx, key_images_container& keys_this_block) const;
1553
1563 void check_ring_signature(const crypto::hash &tx_prefix_hash, const crypto::key_image &key_image,
1564 const std::vector<rct::ctkey> &pubkeys, const std::vector<crypto::signature> &sig, uint64_t &result) const;
1565
1576
1584 bool expand_transaction_2(transaction &tx, const crypto::hash &tx_prefix_hash, const std::vector<std::vector<rct::ctkey>> &pubkeys) const;
1585
1590
1596 void cache_block_template(const block &b, const cryptonote::account_public_address &address, const blobdata &nonce, const difficulty_type &diff, uint64_t height, uint64_t expected_reward, uint64_t seed_height, const crypto::hash &seed_hash, uint64_t pool_cookie);
1597
1606 void send_miner_notifications(uint64_t height, const crypto::hash &seed_hash, const crypto::hash &prev_id, uint64_t already_generated_coins);
1607 };
1608} // namespace cryptonote
cryptonote::block b
Definition: block.cpp:40
static boost::multiprecision::uint128_t fees
Definition: blockchain_stats.cpp:58
static uint64_t h
Definition: blockchain_stats.cpp:55
The BlockchainDB backing store interface declaration/contract.
Definition: blockchain_db.h:379
virtual uint64_t height() const =0
fetch the current blockchain height
virtual uint32_t get_blockchain_pruning_seed() const =0
get the blockchain pruning seed
Definition: blockchain.h:100
bool m_fast_sync
Definition: blockchain.h:1155
std::vector< crypto::hash > m_blocks_txs_check
Definition: blockchain.h:1152
crypto::hash get_tail_id() const
get the hash of the most recent block on the blockchain
Definition: blockchain.cpp:704
crypto::hash get_block_id_by_height(uint64_t height) const
gets a block's hash given a height
Definition: blockchain.cpp:768
void check_ring_signature(const crypto::hash &tx_prefix_hash, const crypto::key_image &key_image, const std::vector< rct::ctkey > &pubkeys, const std::vector< crypto::signature > &sig, uint64_t &result) const
validates a transaction input's ring signature
Definition: blockchain.cpp:3726
uint8_t get_ideal_hard_fork_version(uint64_t height) const
returns the newest hardfork version voted to be enabled as of a certain height
Definition: blockchain.h:884
bool validate_miner_transaction(const block &b, size_t cumulative_block_weight, uint64_t fee, uint64_t &base_reward, uint64_t already_generated_coins, bool &partial_block_reward, uint8_t version)
validates a miner (coinbase) transaction
Definition: blockchain.cpp:1398
bool check_fee(size_t tx_weight, uint64_t fee) const
validate a transaction's fee
Definition: blockchain.cpp:3786
bool check_block_timestamp(const block &b) const
Definition: blockchain.h:1505
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: blockchain.cpp:5110
bool has_block_weights(uint64_t height, uint64_t nblocks) const
checks whether we have known weights for the given block heights
Definition: blockchain.cpp:5091
uint8_t get_current_hard_fork_version() const
gets the current hardfork version in use/voted for
Definition: blockchain.h:860
bool get_txpool_tx_meta(const crypto::hash &txid, txpool_tx_meta_t &meta) const
Definition: blockchain.cpp:5478
bool prune_blockchain(uint32_t pruning_seed=0)
Definition: blockchain.cpp:4586
std::vector< MinerNotifyCallback > m_miner_notifiers
Definition: blockchain.h:1217
size_t m_current_block_cumul_weight_limit
Definition: blockchain.h:1142
uint64_t m_max_prepare_blocks_threads
Definition: blockchain.h:1160
void get_dynamic_base_fee_estimate_2021_scaling(uint64_t grace_blocks, uint64_t base_reward, uint64_t Mnw, uint64_t Mlw, std::vector< uint64_t > &fees) const
Definition: blockchain.cpp:3840
bool m_db_default_sync
Definition: blockchain.h:1157
uint64_t m_prepare_nblocks
Definition: blockchain.h:1222
uint64_t m_bytes_to_sync
Definition: blockchain.h:1164
bool expand_transaction_2(transaction &tx, const crypto::hash &tx_prefix_hash, const std::vector< std::vector< rct::ctkey > > &pubkeys) const
expands v2 transaction data from blockchain
Definition: blockchain.cpp:3214
crypto::hash m_btc_seed_hash
Definition: blockchain.h:1205
uint64_t get_long_term_block_weight_median(uint64_t start_height, size_t count) const
gets block long term weight median
Definition: blockchain.cpp:1475
epee::critical_section m_difficulty_lock
Definition: blockchain.h:1174
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: blockchain.cpp:2961
bool m_enforce_dns_checkpoints
Definition: blockchain.h:1187
bool get_block_by_hash(const crypto::hash &h, block &blk, bool *orphan=NULL) const
gets the block with a given hash
Definition: blockchain.cpp:802
bool for_all_txpool_txes(std::function< bool(const crypto::hash &, const txpool_tx_meta_t &, const cryptonote::blobdata_ref *)>, bool include_blob=false, relay_category tx_category=relay_category::broadcasted) const
Definition: blockchain.cpp:5493
void safesyncmode(const bool onoff)
Put DB in safe sync mode.
Definition: blockchain.cpp:5535
uint64_t m_long_term_block_weights_window
Definition: blockchain.h:1169
void flush_invalid_blocks()
flush the invalid blocks set
Definition: blockchain.cpp:2817
epee::critical_section m_blockchain_lock
Definition: blockchain.h:1139
void add_txpool_tx(const crypto::hash &txid, const cryptonote::blobdata &blob, const txpool_tx_meta_t &meta)
Definition: blockchain.cpp:5458
bool handle_block_to_main_chain(const block &bl, block_verification_context &bvc, bool notify=true)
validate and add a new block to the end of the blockchain
Definition: blockchain.cpp:2862
block pop_block_from_blockchain()
removes the most recent block from the blockchain
Definition: blockchain.cpp:592
void load_compiled_in_block_hashes(const GetCheckpointsCallback &get_checkpoints)
loads block hashes from compiled-in data set
crypto::public_key get_output_key(uint64_t amount, uint64_t global_index) const
get the public key for an output
Definition: blockchain.cpp:2299
uint64_t m_long_term_effective_median_block_weight
Definition: blockchain.h:1170
void update_txpool_tx(const crypto::hash &txid, const txpool_tx_meta_t &meta)
Definition: blockchain.cpp:5463
bool add_block_as_invalid(const block &bl, const crypto::hash &h)
stores an invalid block in a separate container
Definition: blockchain.cpp:2799
bool get_split_transactions_blobs(const t_ids_container &txs_ids, t_tx_container &txs, t_missed_container &missed_txs) const
Definition: blockchain.cpp:2638
uint64_t m_fake_scan_time
Definition: blockchain.h:1162
void set_enforce_dns_checkpoints(bool enforce)
configure whether or not to enforce DNS-based checkpoints
Definition: blockchain.cpp:4852
bool check_blockchain_pruning()
Definition: blockchain.cpp:4604
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: blockchain.cpp:1820
std::vector< block_extended_info > blocks_container
Definition: blockchain.h:1130
BlockchainDB * m_db
Definition: blockchain.h:1135
blobdata m_btc_nonce
Definition: blockchain.h:1200
uint64_t get_dynamic_base_fee_estimate(uint64_t grace_blocks) const
get dynamic per kB or byte fee estimate for the next few blocks
Definition: blockchain.cpp:3915
boost::asio::io_service m_async_service
Definition: blockchain.h:1178
void output_scan_worker(const uint64_t amount, const std::vector< uint64_t > &offsets, std::vector< output_data_t > &outputs) const
get a number of outputs of a specific amount
Definition: blockchain.cpp:4955
const checkpoints & get_checkpoints() const
get a set of blockchain checkpoint hashes
Definition: blockchain.h:166
void add_block_notify(BlockNotifyCallback &&notify)
sets a block notify object to call for every new block
Definition: blockchain.cpp:5517
size_t m_current_block_cumul_weight_median
Definition: blockchain.h:1143
uint64_t get_next_long_term_block_weight(uint64_t block_weight) const
gets the long term block weight for a new block
Definition: blockchain.cpp:4614
network_type m_nettype
Definition: blockchain.h:1191
bool update_checkpoints(const std::string &file_path, bool check_dns)
loads new checkpoints from a file and optionally from DNS
Definition: blockchain.cpp:4817
void add_miner_notify(MinerNotifyCallback &&notify)
sets a miner notify object to call for every new block
Definition: blockchain.cpp:5526
std::vector< std::pair< crypto::hash, uint64_t > > m_blocks_hash_check
Definition: blockchain.h:1151
uint64_t prevalidate_block_hashes(uint64_t height, const std::vector< crypto::hash > &hashes, const std::vector< uint64_t > &weights)
Definition: blockchain.cpp:4971
bool check_block_timestamp(const block &b, uint64_t &median_ts) const
checks a block's timestamp
Definition: blockchain.cpp:4106
bool is_within_compiled_block_hash_area() const
Definition: blockchain.h:1057
uint64_t get_txpool_tx_count(bool include_sensitive=false) const
Definition: blockchain.cpp:5473
~Blockchain()
Blockchain destructor.
Definition: blockchain.cpp:106
void set_show_time_stats(bool stats)
set whether or not to show/print time statistics
Definition: blockchain.h:846
uint64_t m_timestamps_and_difficulties_height
Definition: blockchain.h:1167
std::unordered_map< crypto::hash, block_extended_info > blocks_ext_by_hash
Definition: blockchain.h:1132
account_public_address m_btc_address
Definition: blockchain.h:1199
bool deinit()
Uninitializes the blockchain state.
Definition: blockchain.cpp:510
blockchain_db_sync_mode m_db_sync_mode
Definition: blockchain.h:1154
crypto::hash m_long_term_block_weights_cache_tip_hash
Definition: blockchain.h:1171
bool txpool_tx_matches_category(const crypto::hash &tx_hash, relay_category category)
Definition: blockchain.cpp:5498
HardFork::State get_hard_fork_state() const
gets the hardfork voting state object
Definition: blockchain.cpp:5547
uint64_t m_sync_counter
Definition: blockchain.h:1163
difficulty_type m_difficulty_for_next_block
Definition: blockchain.h:1176
uint64_t get_current_cumulative_block_weight_median() const
gets the block weight median based on recent blocks (same window as for the limit)
Definition: blockchain.cpp:1529
difficulty_type block_difficulty(uint64_t i) const
gets the difficulty of the block with a given height
Definition: blockchain.cpp:2469
bool m_show_time_stats
Definition: blockchain.h:1156
std::unordered_map< crypto::hash, crypto::hash > m_blocks_longhash_table
Definition: blockchain.h:1147
bool scan_outputkeys_for_indexes(size_t tx_version, const txin_to_key &tx_in_to_key, visitor_t &vis, const crypto::hash &tx_prefix_hash, uint64_t *pmax_related_block_height=NULL) const
collects the keys for all outputs being "spent" as an input
Definition: blockchain.cpp:136
std::vector< std::pair< block_extended_info, std::vector< crypto::hash > > > get_alternative_chains() const
returns a set of known alternate chains
Definition: blockchain.cpp:5567
std::vector< difficulty_type > m_difficulties
Definition: blockchain.h:1166
bool is_tx_spendtime_unlocked(uint64_t unlock_time, uint8_t hf_version) const
checks if a transaction is unlocked (its outputs spendable)
Definition: blockchain.cpp:3963
tx_memory_pool & m_tx_pool
Definition: blockchain.h:1137
bool get_blocks(uint64_t start_offset, size_t count, std::vector< std::pair< cryptonote::blobdata, block > > &blocks, std::vector< cryptonote::blobdata > &txs) const
get blocks and transactions from blocks based on start height and count
Definition: blockchain.cpp:2151
bool prevalidate_miner_transaction(const block &b, uint64_t height, uint8_t hf_version)
sanity checks a miner transaction before validating an entire block
Definition: blockchain.cpp:1364
bool check_block_timestamp(std::vector< uint64_t > &timestamps, const block &b) const
Definition: blockchain.h:1519
void set_reorg_notify(const std::shared_ptr< tools::Notify > &notify)
sets a reorg notify object to call for every reorg
Definition: blockchain.h:834
uint64_t m_btc_expected_reward
Definition: blockchain.h:1204
uint64_t m_btc_height
Definition: blockchain.h:1202
bool get_alternative_blocks(std::vector< block > &blocks) const
compiles a list of all blocks stored as alternative chains
Definition: blockchain.cpp:2250
std::atomic< bool > m_cancel
Definition: blockchain.h:1195
bool update_blockchain_pruning()
Definition: blockchain.cpp:4595
void on_new_tx_from_block(const cryptonote::transaction &tx)
called when we see a tx originating from a block
Definition: blockchain.cpp:2977
void check_against_checkpoints(const checkpoints &points, bool enforce)
check the blockchain against a set of checkpoints
Definition: blockchain.cpp:4779
void cache_block_template(const block &b, const cryptonote::account_public_address &address, const blobdata &nonce, const difficulty_type &diff, uint64_t height, uint64_t expected_reward, uint64_t seed_height, const crypto::hash &seed_hash, uint64_t pool_cookie)
stores a new cached block template
Definition: blockchain.cpp:5772
crypto::hash m_difficulty_for_next_block_top_hash
Definition: blockchain.h:1175
bool complete_timestamps_vector(uint64_t start_height, std::vector< uint64_t > &timestamps) const
finish an alternate chain's timestamp window from the main chain
Definition: blockchain.cpp:1846
uint64_t get_current_cumulative_block_weight_limit() const
gets the block weight limit based on recent blocks
Definition: blockchain.cpp:1523
std::vector< time_t > get_last_block_timestamps(unsigned int blocks) const
returns the timestamps of the last N blocks
Definition: blockchain.cpp:1102
std::vector< std::pair< crypto::hash, crypto::hash > > m_blocks_hash_of_hashes
Definition: blockchain.h:1150
bool for_blocks_range(const uint64_t &h1, const uint64_t &h2, std::function< bool(uint64_t, const crypto::hash &, const block &)>) const
perform a check on all blocks in the blockchain in the given range
Definition: blockchain.cpp:5746
uint64_t m_btc_pool_cookie
Definition: blockchain.h:1203
bool rollback_blockchain_switching(std::list< block > &original_chain, uint64_t rollback_height)
reverts the blockchain to its previous state following a failed switch
Definition: blockchain.cpp:1117
bool create_block_template(block &b, const account_public_address &miner_address, difficulty_type &di, uint64_t &height, uint64_t &expected_reward, const blobdata &ex_nonce, uint64_t &seed_height, crypto::hash &seed_hash)
creates a new block to mine against
Definition: blockchain.cpp:1815
bool store_blockchain()
stores the blockchain
Definition: blockchain.cpp:480
uint64_t get_num_mature_outputs(uint64_t amount) const
get number of outputs of an amount past the minimum spendable age
Definition: blockchain.cpp:2281
bool have_block_unlocked(const crypto::hash &id, int *where=NULL) const
checks if a block is known about with a given hash
Definition: blockchain.cpp:2824
void set_user_options(uint64_t maxthreads, bool sync_on_blocks, uint64_t sync_threshold, blockchain_db_sync_mode sync_mode, bool fast_sync)
sets various performance options
Definition: blockchain.cpp:5503
difficulty_type get_difficulty_for_next_block()
returns the difficulty target the next block to be added must meet
Definition: blockchain.cpp:850
uint8_t get_next_hard_fork_version() const
returns the next hardfork version
Definition: blockchain.h:874
std::shared_ptr< tools::Notify > m_reorg_notify
Definition: blockchain.h:1218
void get_last_n_blocks_weights(std::vector< uint64_t > &weights, size_t count) const
gets recent block weights for median calculation
Definition: blockchain.cpp:1460
uint64_t m_fake_pow_calc_time
Definition: blockchain.h:1161
const BlockchainDB & get_db() const
get a reference to the BlockchainDB in use by Blockchain
Definition: blockchain.h:1005
std::vector< uint64_t > m_timestamps
Definition: blockchain.h:1165
void invalidate_block_template_cache()
invalidates any cached block template
Definition: blockchain.cpp:5766
bool check_tx_outputs(const transaction &tx, tx_verification_context &tvc) const
check that a transaction's outputs conform to current standards
Definition: blockchain.cpp:3034
bool cleanup_handle_incoming_blocks(bool force_sync=false)
incoming blocks post-processing, cleanup, and disk sync
Definition: blockchain.cpp:4877
bool m_offline
Definition: blockchain.h:1192
size_t recalculate_difficulties(boost::optional< uint64_t > start_height=boost::none)
recalculate difficulties for blocks after the last difficulty checkpoints to circumvent the annoying ...
Definition: blockchain.cpp:1011
difficulty_type m_fixed_difficulty
Definition: blockchain.h:1193
void remove_txpool_tx(const crypto::hash &txid)
Definition: blockchain.cpp:5468
uint8_t get_hard_fork_version(uint64_t height) const
returns the actual hardfork version for a given block height
Definition: blockchain.h:893
std::vector< block > * m_prepare_blocks
Definition: blockchain.h:1223
bool for_all_transactions(std::function< bool(const crypto::hash &, const cryptonote::transaction &)>, bool pruned) const
perform a check on all transactions in the blockchain
Definition: blockchain.cpp:5751
uint64_t get_difficulty_target() const
get difficulty target based on chain and hardfork version
Definition: blockchain.cpp:5557
bool check_for_double_spend(const transaction &tx, key_images_container &keys_this_block) const
make sure a transaction isn't attempting a double-spend
Definition: blockchain.cpp:2885
void block_longhash_worker(uint64_t height, const epee::span< const block > &blocks, std::unordered_map< crypto::hash, crypto::hash > &map) const
computes the "short" and "long" hashes for a set of blocks
Definition: blockchain.cpp:4858
bool for_all_outputs(std::function< bool(uint64_t amount, const crypto::hash &tx_hash, uint64_t height, size_t tx_idx)>) const
perform a check on all outputs in the blockchain
Definition: blockchain.cpp:5756
crypto::hash get_pending_block_id_by_height(uint64_t height) const
gets a block's hash given a height
Definition: blockchain.cpp:795
void send_miner_notifications(uint64_t height, const crypto::hash &seed_hash, const crypto::hash &prev_id, uint64_t already_generated_coins)
sends new block notifications to ZMQ miner_data subscribers
Definition: blockchain.cpp:5787
HardFork * m_hardfork
Definition: blockchain.h:1189
bool find_blockchain_supplement(const std::list< crypto::hash > &qblock_ids, std::vector< crypto::hash > &hashes, std::vector< uint64_t > *weights, uint64_t &start_height, uint64_t &current_height, bool clip_pruned) const
get recent block hashes for a foreign chain
Definition: blockchain.cpp:2708
boost::thread_group m_async_pool
Definition: blockchain.h:1179
difficulty_type get_next_difficulty_for_alternative_chain(const std::list< block_extended_info > &alt_chain, block_extended_info &bei) const
gets the difficulty requirement for a new block on an alternate chain
Definition: blockchain.cpp:1290
BlockchainDB & get_db()
get a reference to the BlockchainDB in use by Blockchain
Definition: blockchain.h:1015
blocks_ext_by_hash m_invalid_blocks
Definition: blockchain.h:1183
bool handle_alternative_block(const block &b, const crypto::hash &id, block_verification_context &bvc)
validate and add a new block to an alternate blockchain
Definition: blockchain.cpp:1927
bool m_btc_valid
Definition: blockchain.h:1207
block m_btc
Definition: blockchain.h:1198
size_t get_alternative_blocks_count() const
returns the number of alternative blocks stored
Definition: blockchain.cpp:2272
uint8_t get_ideal_hard_fork_version() const
returns the newest hardfork version known to the blockchain
Definition: blockchain.h:867
uint32_t get_blockchain_pruning_seed() const
Definition: blockchain.h:1059
static uint64_t get_dynamic_base_fee(uint64_t block_reward, size_t median_block_weight, uint8_t version)
get dynamic per kB or byte fee for a given block weight
Definition: blockchain.cpp:3740
bool have_tx(const crypto::hash &id) const
search the blockchain for a transaction by hash
Definition: blockchain.cpp:112
uint64_t m_btc_seed_height
Definition: blockchain.h:1206
bool for_all_key_images(std::function< bool(const crypto::key_image &)>) const
perform a check on all key images in the blockchain
Definition: blockchain.cpp:5741
epee::misc_utils::rolling_median_t< uint64_t > m_long_term_block_weights_cache_rolling_median
Definition: blockchain.h:1172
std::map< uint64_t, std::tuple< uint64_t, uint64_t, uint64_t > > get_output_histogram(const std::vector< uint64_t > &amounts, bool unlocked, uint64_t recent_cutoff, uint64_t min_count=0) const
return a histogram of outputs on the blockchain
Definition: blockchain.cpp:5562
bool check_tx_inputs(transaction &tx, uint64_t &pmax_used_block_height, crypto::hash &max_used_block_id, tx_verification_context &tvc, bool kept_by_block=false) const
validates a transaction's inputs
Definition: blockchain.cpp:3003
bool switch_to_alternative_blockchain(std::list< block_extended_info > &alt_chain, bool discard_disconnected_chain)
performs a blockchain reorganization according to the longest chain rule
Definition: blockchain.cpp:1161
size_t get_total_transactions() const
gets the total number of transactions on the main chain
Definition: blockchain.cpp:2869
uint64_t get_earliest_ideal_height_for_version(uint8_t version) const
returns the earliest block a given version may activate
Definition: blockchain.h:900
bool reset_and_set_genesis_block(const block &b)
clears the blockchain and starts a new one
Definition: blockchain.cpp:678
void return_tx_to_pool(std::vector< std::pair< transaction, blobdata > > &txs)
Definition: blockchain.cpp:4136
bool have_tx_keyimges_as_spent(const transaction &tx) const
check if any key image in a transaction has already been spent
Definition: blockchain.cpp:3203
void lock()
Definition: blockchain.cpp:5731
bool get_transactions_blobs(const std::vector< crypto::hash > &txs_ids, std::vector< cryptonote::blobdata > &txs, std::vector< crypto::hash > &missed_txs, bool pruned=false) const
gets transactions based on a list of transaction hashes
Definition: blockchain.cpp:2578
bool m_reset_timestamps_and_difficulties_height
Definition: blockchain.h:1168
void unlock()
Definition: blockchain.cpp:5736
bool update_next_cumulative_weight_limit(uint64_t *long_term_effective_median_block_weight=NULL)
calculate the block weight limit for the next block to be added
Definition: blockchain.cpp:4645
bool flush_txes_from_pool(const std::vector< crypto::hash > &txids)
remove transactions from the transaction pool (if present)
Definition: blockchain.cpp:4156
bool get_txpool_tx_blob(const crypto::hash &txid, cryptonote::blobdata &bd, relay_category tx_category) const
Definition: blockchain.cpp:5483
bool m_db_sync_on_blocks
Definition: blockchain.h:1158
uint64_t m_db_sync_threshold
Definition: blockchain.h:1159
std::unordered_set< crypto::key_image > key_images_container
Definition: blockchain.h:1128
bool get_short_chain_history(std::list< crypto::hash > &ids) const
gets the hashes for a subset of the blockchain
Definition: blockchain.cpp:726
std::unique_ptr< boost::asio::io_service::work > m_async_work_idle
Definition: blockchain.h:1180
bool add_new_block(const block &bl_, block_verification_context &bvc)
adds a block to the blockchain
Definition: blockchain.cpp:4735
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: blockchain.cpp:2306
std::unordered_map< crypto::hash, std::unordered_map< crypto::key_image, std::vector< output_data_t > > > m_scan_table
Definition: blockchain.h:1146
uint64_t get_adjusted_time(uint64_t height) const
get the "adjusted time"
Definition: blockchain.cpp:4051
bool build_alt_chain(const crypto::hash &prev_id, std::list< block_extended_info > &alt_chain, std::vector< uint64_t > &timestamps, block_verification_context &bvc) const
builds a list of blocks connecting a block to the main chain
Definition: blockchain.cpp:1866
checkpoints m_checkpoints
Definition: blockchain.h:1186
bool m_batch_success
Definition: blockchain.h:1210
void cancel()
Definition: blockchain.cpp:5624
bool have_tx_keyimg_as_spent(const crypto::key_image &key_im) const
check if a key image is already spent on the blockchain
Definition: blockchain.cpp:122
bool get_transactions(const t_ids_container &txs_ids, t_tx_container &txs, t_missed_container &missed_txs, bool pruned=false) const
Definition: blockchain.cpp:2672
static uint64_t get_fee_quantization_mask()
get fee quantization mask
Definition: blockchain.h:624
bool handle_get_objects(NOTIFY_REQUEST_GET_OBJECTS::request &arg, NOTIFY_RESPONSE_GET_OBJECTS::request &rsp)
retrieves a set of blocks and their transactions, and possibly other transactions
Definition: blockchain.cpp:2201
const std::vector< hardfork_t > & get_hardforks() const
returns info for all known hard forks
Definition: blockchain.h:907
std::vector< BlockNotifyCallback > m_block_notifiers
Definition: blockchain.h:1216
difficulty_type m_btc_difficulty
Definition: blockchain.h:1201
void get_output_key_mask_unlocked(const uint64_t &amount, const uint64_t &index, crypto::public_key &key, rct::key &mask, bool &unlocked) const
gets an output's key and unlocked state
Definition: blockchain.cpp:2351
bool have_block(const crypto::hash &id, int *where=NULL) const
Definition: blockchain.cpp:2856
uint64_t get_current_blockchain_height() const
get the current height of the blockchain
Definition: blockchain.cpp:267
void pop_blocks(uint64_t nblocks)
removes blocks from the top of the blockchain
Definition: blockchain.cpp:550
uint64_t m_prepare_height
Definition: blockchain.h:1221
bool get_hard_fork_voting_info(uint8_t version, uint32_t &window, uint32_t &votes, uint32_t &threshold, uint64_t &earliest_height, uint8_t &voting) const
get information about hardfork voting for a version
Definition: blockchain.cpp:5552
void set_checkpoints(checkpoints &&chk_pts)
assign a set of blockchain checkpoint hashes
Definition: blockchain.h:173
std::pair< bool, uint64_t > check_difficulty_checkpoints() const
check currently stored difficulties against difficulty checkpoints
Definition: blockchain.cpp:997
bool check_tx_input(size_t tx_version, const txin_to_key &txin, const crypto::hash &tx_prefix_hash, const std::vector< crypto::signature > &sig, const rct::rctSig &rct_signatures, std::vector< rct::ctkey > &output_keys, uint64_t *pmax_related_block_height, uint8_t hf_version) const
collect output public keys of a transaction input set
Definition: blockchain.cpp:3990
Definition: hardfork.h:40
State
Definition: hardfork.h:42
uint8_t get_ideal_version() const
returns the latest "ideal" version
Definition: hardfork.cpp:366
uint8_t get_current_version() const
returns the current version
Definition: hardfork.cpp:360
uint8_t get_next_version() const
returns the next version
Definition: hardfork.cpp:396
uint64_t get_earliest_ideal_height_for_version(uint8_t version) const
returns the earliest block a given version may activate
Definition: hardfork.cpp:383
const std::vector< hardfork_t > & get_hardforks() const
returns info for all known hard forks
Definition: hardfork.h:237
uint8_t get(uint64_t height) const
returns the hard fork version for the given block height
Definition: hardfork.cpp:347
A container for blockchain checkpoints.
Definition: checkpoints.h:53
Definition: cryptonote_basic.h:205
Transaction pool, handles transactions which are not part of a block.
Definition: tx_pool.h:98
Definition: syncobj.h:82
Non-owning sequence of data. Does not deep copy.
Definition: span.h:55
std::tuple< uint64_t, uint64_t, std::vector< tools::wallet2::transfer_details > > outputs
Definition: cold-outputs.cpp:53
#define PER_KB_FEE_QUANTIZATION_DECIMALS
Definition: cryptonote_config.h:191
#define CRYPTONOTE_DISPLAY_DECIMAL_POINT
Definition: cryptonote_config.h:64
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2116
int * count
Definition: gmock_stress_test.cc:176
const char * res
Definition: hmac_keccak.cpp:42
const char * key
Definition: hmac_keccak.cpp:40
static void init()
Definition: logging.cpp:38
static int version
Definition: mdb_load.c:29
uint32_t address
Definition: getifaddr.c:269
Definition: base.py:1
Definition: block_weight.py:1
Definition: blocks.cpp:13
POD_CLASS public_key
Definition: crypto.h:64
POD_CLASS key_image
Definition: crypto.h:95
POD_CLASS hash
Definition: hash.h:48
Holds cryptonote related classes and helpers.
Definition: blockchain_db.cpp:45
boost::function< void(uint64_t, epee::span< const block >)> BlockNotifyCallback
Definition: blockchain.h:93
boost::multiprecision::uint128_t difficulty_type
Definition: difficulty.h:41
network_type
Definition: cryptonote_config.h:289
@ MAINNET
Definition: cryptonote_config.h:290
relay_category
Definition: blockchain_db.h:110
@ broadcasted
Public txes received via block/fluff.
blockchain_db_sync_mode
Definition: blockchain.h:77
@ db_async
handle syncing calls instead of the backing db, asynchronously
Definition: blockchain.h:80
@ db_nosync
Leave syncing up to the backing db (safest, but slowest because of disk I/O)
Definition: blockchain.h:81
@ db_sync
handle syncing calls instead of the backing db, synchronously
Definition: blockchain.h:79
@ db_defaultsync
user didn't specify, use db_async
Definition: blockchain.h:78
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:91
std::string blobdata
Definition: blobdatatype.h:39
boost::string_ref blobdata_ref
Definition: blobdatatype.h:40
boost::function< void(uint8_t, uint64_t, const crypto::hash &, const crypto::hash &, difficulty_type, uint64_t, uint64_t, const std::vector< tx_block_template_backlog_entry > &)> MinerNotifyCallback
Definition: blockchain.h:94
Definition: get_output_distribution.py:1
Various Tools.
Definition: apply_permutation.h:40
tools::wallet2::message_signature_result_t result
Definition: signature.cpp:62
unsigned int uint32_t
Definition: stdint.h:126
unsigned char uint8_t
Definition: stdint.h:124
unsigned __int64 uint64_t
Definition: stdint.h:136
container for passing a block and metadata about it on the blockchain
Definition: blockchain.h:106
uint64_t already_generated_coins
the total coins minted after that block
Definition: blockchain.h:111
uint64_t height
the height of the block in the blockchain
Definition: blockchain.h:108
block bl
the block
Definition: blockchain.h:107
difficulty_type cumulative_difficulty
the accumulated difficulty after that block
Definition: blockchain.h:110
uint64_t block_cumulative_weight
the weight of the block
Definition: blockchain.h:109
Definition: cryptonote_basic.h:512
Definition: verification_context.h:59
Definition: cryptonote_basic.h:475
Definition: cryptonote_core.h:61
Definition: verification_context.h:41
Definition: cryptonote_basic.h:139
a struct containing txpool per transaction metadata
Definition: blockchain_db.h:155
Definition: rolling_median.h:49
Definition: misc_language.h:104
Definition: rctTypes.h:79
Definition: rctTypes.h:595
Definition: powerof.h:9
struct hash_func hashes[]
cryptonote::transaction tx
Definition: transaction.cpp:40