Monero
Loading...
Searching...
No Matches
testdb.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 <string>
34#include <vector>
35#include <map>
36
37#include "blockchain_db.h"
38
39namespace cryptonote
40{
41
43public:
45 virtual void open(const std::string& filename, const int db_flags = 0) override { }
46 virtual void close() override {}
47 virtual void sync() override {}
48 virtual void safesyncmode(const bool onoff) override {}
49 virtual void reset() override {}
50 virtual std::vector<std::string> get_filenames() const override { return std::vector<std::string>(); }
51 virtual bool remove_data_file(const std::string& folder) const override { return true; }
52 virtual std::string get_db_name() const override { return std::string(); }
53 virtual bool lock() override { return true; }
54 virtual void unlock() override { }
55 virtual bool batch_start(uint64_t batch_num_blocks=0, uint64_t batch_bytes=0) override { return true; }
56 virtual void batch_stop() override {}
57 virtual void batch_abort() override {}
58 virtual void set_batch_transactions(bool) override {}
59 virtual void block_wtxn_start() override {}
60 virtual void block_wtxn_stop() override {}
61 virtual void block_wtxn_abort() override {}
62 virtual bool block_rtxn_start() const override { return true; }
63 virtual void block_rtxn_stop() const override {}
64 virtual void block_rtxn_abort() const override {}
65
66 virtual void drop_hard_fork_info() override {}
67 virtual bool block_exists(const crypto::hash& h, uint64_t *height) const override { return false; }
69 virtual cryptonote::blobdata get_block_blob(const crypto::hash& h) const override { return cryptonote::blobdata(); }
70 virtual bool get_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const override { return false; }
71 virtual bool get_pruned_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const override { return false; }
72 virtual bool get_pruned_tx_blobs_from(const crypto::hash& h, size_t count, std::vector<cryptonote::blobdata> &bd) const override { return false; }
73 virtual bool get_blocks_from(uint64_t start_height, size_t min_block_count, size_t max_block_count, size_t max_tx_count, size_t max_size, std::vector<std::pair<std::pair<cryptonote::blobdata, crypto::hash>, std::vector<std::pair<crypto::hash, cryptonote::blobdata>>>>& blocks, bool pruned, bool skip_coinbase, bool get_miner_tx_hash) const override { return false; }
74 virtual bool get_prunable_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const override { return false; }
75 virtual bool get_prunable_tx_hash(const crypto::hash& tx_hash, crypto::hash &prunable_hash) const override { return false; }
76 virtual uint64_t get_block_height(const crypto::hash& h) const override { return 0; }
78 virtual uint64_t get_block_timestamp(const uint64_t& height) const override { return 0; }
79 virtual std::vector<uint64_t> get_block_cumulative_rct_outputs(const std::vector<uint64_t> &heights) const override { return {}; }
80 virtual uint64_t get_top_block_timestamp() const override { return 0; }
81 virtual size_t get_block_weight(const uint64_t& height) const override { return 128; }
82 virtual std::vector<uint64_t> get_block_weights(uint64_t start_height, size_t count) const override { return {}; }
83 virtual cryptonote::difficulty_type get_block_cumulative_difficulty(const uint64_t& height) const override { return 10; }
84 virtual cryptonote::difficulty_type get_block_difficulty(const uint64_t& height) const override { return 0; }
85 virtual void correct_block_cumulative_difficulties(const uint64_t& start_height, const std::vector<difficulty_type>& new_cumulative_difficulties) override {}
86 virtual uint64_t get_block_already_generated_coins(const uint64_t& height) const override { return 10000000000; }
87 virtual uint64_t get_block_long_term_weight(const uint64_t& height) const override { return 128; }
88 virtual std::vector<uint64_t> get_long_term_block_weights(uint64_t start_height, size_t count) const override { return {}; }
89 virtual crypto::hash get_block_hash_from_height(const uint64_t& height) const override { return crypto::hash(); }
90 virtual std::vector<cryptonote::block> get_blocks_range(const uint64_t& h1, const uint64_t& h2) const override { return std::vector<cryptonote::block>(); }
91 virtual std::vector<crypto::hash> get_hashes_range(const uint64_t& h1, const uint64_t& h2) const override { return std::vector<crypto::hash>(); }
92 virtual crypto::hash top_block_hash(uint64_t *block_height = NULL) const override { if (block_height) *block_height = 0; return crypto::hash(); }
93 virtual cryptonote::block get_top_block() const override { return cryptonote::block(); }
94 virtual uint64_t height() const override { return 1; }
95 virtual bool tx_exists(const crypto::hash& h) const override { return false; }
96 virtual bool tx_exists(const crypto::hash& h, uint64_t& tx_index) const override { return false; }
97 virtual uint64_t get_tx_unlock_time(const crypto::hash& h) const override { return 0; }
98 virtual cryptonote::transaction get_tx(const crypto::hash& h) const override { return cryptonote::transaction(); }
99 virtual bool get_tx(const crypto::hash& h, cryptonote::transaction &tx) const override { return false; }
100 virtual uint64_t get_tx_count() const override { return 0; }
101 virtual std::vector<cryptonote::transaction> get_tx_list(const std::vector<crypto::hash>& hlist) const override { return std::vector<cryptonote::transaction>(); }
102 virtual uint64_t get_tx_block_height(const crypto::hash& h) const override { return 0; }
103 virtual uint64_t get_num_outputs(const uint64_t& amount) const override { return 1; }
104 virtual uint64_t get_indexing_base() const override { return 0; }
105 virtual cryptonote::output_data_t get_output_key(const uint64_t& amount, const uint64_t& index, bool include_commitmemt) const override { return cryptonote::output_data_t(); }
107 virtual cryptonote::tx_out_index get_output_tx_and_index(const uint64_t& amount, const uint64_t& index) const override { return cryptonote::tx_out_index(); }
108 virtual void get_output_tx_and_index(const uint64_t& amount, const std::vector<uint64_t> &offsets, std::vector<cryptonote::tx_out_index> &indices) const override {}
109 virtual void get_output_key(const epee::span<const uint64_t> &amounts, const std::vector<uint64_t> &offsets, std::vector<cryptonote::output_data_t> &outputs, bool allow_partial = false) const override {}
110 virtual bool can_thread_bulk_indices() const override { return false; }
111 virtual std::vector<std::vector<uint64_t>> get_tx_amount_output_indices(const uint64_t tx_index, size_t n_txes) const override { return std::vector<std::vector<uint64_t>>(); }
112 virtual bool has_key_image(const crypto::key_image& img) const override { return false; }
113 virtual void remove_block() override { }
114 virtual uint64_t add_transaction_data(const crypto::hash& blk_hash, const std::pair<cryptonote::transaction, cryptonote::blobdata_ref>& tx, const crypto::hash& tx_hash, const crypto::hash& tx_prunable_hash) override {return 0;}
115 virtual void remove_transaction_data(const crypto::hash& tx_hash, const cryptonote::transaction& tx) override {}
116 virtual uint64_t add_output(const crypto::hash& tx_hash, const cryptonote::tx_out& tx_output, const uint64_t& local_index, const uint64_t unlock_time, const rct::key *commitment) override {return 0;}
117 virtual void add_tx_amount_output_indices(const uint64_t tx_index, const std::vector<uint64_t>& amount_output_indices) override {}
118 virtual void add_spent_key(const crypto::key_image& k_image) override {}
119 virtual void remove_spent_key(const crypto::key_image& k_image) override {}
120
121 virtual bool for_all_key_images(std::function<bool(const crypto::key_image&)>) const override { return true; }
122 virtual bool for_blocks_range(const uint64_t&, const uint64_t&, std::function<bool(uint64_t, const crypto::hash&, const cryptonote::block&)>) const override { return true; }
123 virtual bool for_all_transactions(std::function<bool(const crypto::hash&, const cryptonote::transaction&)>, bool pruned) const override { return true; }
124 virtual bool for_all_outputs(std::function<bool(uint64_t amount, const crypto::hash &tx_hash, uint64_t height, size_t tx_idx)> f) const override { return true; }
125 virtual bool for_all_outputs(uint64_t amount, const std::function<bool(uint64_t height)> &f) const override { return true; }
126 virtual bool is_read_only() const override { return false; }
127 virtual 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) const override { return std::map<uint64_t, std::tuple<uint64_t, uint64_t, uint64_t>>(); }
128 virtual bool get_output_distribution(uint64_t amount, uint64_t from_height, uint64_t to_height, std::vector<uint64_t> &distribution, uint64_t &base) const override { return false; }
129
130 virtual void add_txpool_tx(const crypto::hash &txid, const cryptonote::blobdata_ref &blob, const cryptonote::txpool_tx_meta_t& details) override {}
131 virtual void update_txpool_tx(const crypto::hash &txid, const cryptonote::txpool_tx_meta_t& details) override {}
132 virtual uint64_t get_txpool_tx_count(relay_category tx_relay = relay_category::broadcasted) const override { return 0; }
133 virtual bool txpool_has_tx(const crypto::hash &txid, relay_category tx_category) const override { return false; }
134 virtual void remove_txpool_tx(const crypto::hash& txid) override {}
135 virtual bool get_txpool_tx_meta(const crypto::hash& txid, cryptonote::txpool_tx_meta_t &meta) const override { return false; }
136 virtual bool get_txpool_tx_blob(const crypto::hash& txid, cryptonote::blobdata &bd, relay_category tx_category) const override { return false; }
137 virtual uint64_t get_database_size() const override { return 0; }
138 virtual cryptonote::blobdata get_txpool_tx_blob(const crypto::hash& txid, relay_category tx_category) const override { return ""; }
139 virtual bool for_all_txpool_txes(std::function<bool(const crypto::hash&, const cryptonote::txpool_tx_meta_t&, const cryptonote::blobdata_ref*)>, bool include_blob = false, relay_category category = relay_category::broadcasted) const override { return false; }
140
141 virtual void add_block( const cryptonote::block& blk
142 , size_t block_weight
143 , uint64_t long_term_block_weight
144 , const cryptonote::difficulty_type& cumulative_difficulty
145 , const uint64_t& coins_generated
146 , uint64_t num_rct_outs
147 , const crypto::hash& blk_hash
148 ) override { }
149 virtual cryptonote::block get_block_from_height(const uint64_t& height) const override { return cryptonote::block(); }
151 virtual uint8_t get_hard_fork_version(uint64_t height) const override { return 0; }
152 virtual void check_hard_fork_info() override {}
153
154 virtual uint32_t get_blockchain_pruning_seed() const override { return 0; }
155 virtual bool prune_blockchain(uint32_t pruning_seed = 0) override { return true; }
156 virtual bool update_pruning() override { return true; }
157 virtual bool check_pruning() override { return true; }
158 virtual void prune_outputs(uint64_t amount) override {}
159
160 virtual uint64_t get_max_block_size() override { return 100000000; }
161 virtual void add_max_block_size(uint64_t sz) override { }
162
163 virtual void add_alt_block(const crypto::hash &blkid, const cryptonote::alt_block_data_t &data, const cryptonote::blobdata_ref &blob) override {}
164 virtual bool get_alt_block(const crypto::hash &blkid, alt_block_data_t *data, cryptonote::blobdata *blob) override { return false; }
165 virtual void remove_alt_block(const crypto::hash &blkid) override {}
166 virtual uint64_t get_alt_block_count() override { return 0; }
167 virtual void drop_alt_blocks() override {}
168 virtual bool for_all_alt_blocks(std::function<bool(const crypto::hash &blkid, const alt_block_data_t &data, const cryptonote::blobdata_ref *blob)> f, bool include_blob = false) const override { return true; }
169};
170
171}
static uint64_t db_flags
Definition blockchain_blackball.cpp:52
static uint64_t h
Definition blockchain_stats.cpp:55
virtual bool is_read_only() const override
is BlockchainDB in read-only mode?
Definition testdb.h:126
virtual cryptonote::tx_out_index get_output_tx_and_index(const uint64_t &amount, const uint64_t &index) const override
gets an output's tx hash and index
Definition testdb.h:107
virtual void add_block(const cryptonote::block &blk, size_t block_weight, uint64_t long_term_block_weight, const cryptonote::difficulty_type &cumulative_difficulty, const uint64_t &coins_generated, uint64_t num_rct_outs, const crypto::hash &blk_hash) override
add the block and metadata to the db
Definition testdb.h:141
virtual void remove_txpool_tx(const crypto::hash &txid) override
remove a txpool transaction
Definition testdb.h:134
virtual cryptonote::block_header get_block_header(const crypto::hash &h) const override
fetch a block header
Definition testdb.h:77
virtual std::vector< crypto::hash > get_hashes_range(const uint64_t &h1, const uint64_t &h2) const override
fetch a list of block hashes
Definition testdb.h:91
virtual uint64_t get_tx_count() const override
fetches the total number of transactions ever
Definition testdb.h:100
virtual crypto::hash get_block_hash_from_height(const uint64_t &height) const override
fetch a block's hash
Definition testdb.h:89
virtual std::vector< std::vector< uint64_t > > get_tx_amount_output_indices(const uint64_t tx_index, size_t n_txes) const override
gets output indices (amount-specific) for a transaction's outputs
Definition testdb.h:111
virtual void remove_transaction_data(const crypto::hash &tx_hash, const cryptonote::transaction &tx) override
remove data about a transaction
Definition testdb.h:115
virtual cryptonote::output_data_t get_output_key(const uint64_t &amount, const uint64_t &index, bool include_commitmemt) const override
get some of an output's data
Definition testdb.h:105
virtual uint64_t get_indexing_base() const override
return index of the first element (should be hidden, but isn't)
Definition testdb.h:104
virtual uint64_t get_database_size() const override
get disk space requirements
Definition testdb.h:137
virtual uint64_t get_tx_block_height(const crypto::hash &h) const override
fetches the height of a transaction's block
Definition testdb.h:102
virtual cryptonote::difficulty_type get_block_cumulative_difficulty(const uint64_t &height) const override
fetch a block's cumulative difficulty
Definition testdb.h:83
virtual void sync() override
sync the BlockchainDB with disk
Definition testdb.h:47
virtual bool batch_start(uint64_t batch_num_blocks=0, uint64_t batch_bytes=0) override
tells the BlockchainDB to start a new "batch" of blocks
Definition testdb.h:55
virtual uint64_t height() const override
fetch the current blockchain height
Definition testdb.h:94
virtual void set_batch_transactions(bool) override
sets whether or not to batch transactions
Definition testdb.h:58
virtual void set_hard_fork_version(uint64_t height, uint8_t version) override
sets which hardfork version a height is on
Definition testdb.h:150
virtual bool for_blocks_range(const uint64_t &, const uint64_t &, std::function< bool(uint64_t, const crypto::hash &, const cryptonote::block &)>) const override
runs a function over a range of blocks
Definition testdb.h:122
virtual bool lock() override
acquires the BlockchainDB lock
Definition testdb.h:53
virtual void open(const std::string &filename, const int db_flags=0) override
open a db, or create it if necessary.
Definition testdb.h:45
virtual crypto::hash top_block_hash(uint64_t *block_height=NULL) const override
fetch the top block's hash
Definition testdb.h:92
virtual bool get_output_distribution(uint64_t amount, uint64_t from_height, uint64_t to_height, std::vector< uint64_t > &distribution, uint64_t &base) const override
Definition testdb.h:128
virtual uint64_t get_top_block_timestamp() const override
fetch the top block's timestamp
Definition testdb.h:80
virtual bool get_alt_block(const crypto::hash &blkid, alt_block_data_t *data, cryptonote::blobdata *blob) override
get an alternative block by hash
Definition testdb.h:164
virtual void reset() override
Remove everything from the BlockchainDB.
Definition testdb.h:49
virtual uint64_t get_block_height(const crypto::hash &h) const override
gets the height of the block with a given hash
Definition testdb.h:76
virtual cryptonote::blobdata get_block_blob(const crypto::hash &h) const override
fetches the block with the given hash
Definition testdb.h:69
virtual cryptonote::difficulty_type get_block_difficulty(const uint64_t &height) const override
fetch a block's difficulty
Definition testdb.h:84
virtual void get_output_key(const epee::span< const uint64_t > &amounts, const std::vector< uint64_t > &offsets, std::vector< cryptonote::output_data_t > &outputs, bool allow_partial=false) const override
gets outputs' data
Definition testdb.h:109
virtual void add_tx_amount_output_indices(const uint64_t tx_index, const std::vector< uint64_t > &amount_output_indices) override
store amount output indices for a tx's outputs
Definition testdb.h:117
virtual bool update_pruning() override
prunes recent blockchain changes as needed, iff pruning is enabled
Definition testdb.h:156
virtual bool block_exists(const crypto::hash &h, uint64_t *height) const override
checks if a block exists
Definition testdb.h:67
virtual bool can_thread_bulk_indices() const override
Definition testdb.h:110
virtual bool remove_data_file(const std::string &folder) const override
remove file(s) storing the database
Definition testdb.h:51
virtual void remove_block() override
remove data about the top block
Definition testdb.h:113
virtual uint64_t get_max_block_size() override
get the max block size
Definition testdb.h:160
virtual void get_output_tx_and_index(const uint64_t &amount, const std::vector< uint64_t > &offsets, std::vector< cryptonote::tx_out_index > &indices) const override
gets some outputs' tx hashes and indices
Definition testdb.h:108
virtual bool get_tx(const crypto::hash &h, cryptonote::transaction &tx) const override
fetches the transaction with the given hash
Definition testdb.h:99
virtual uint64_t get_block_timestamp(const uint64_t &height) const override
fetch a block's timestamp
Definition testdb.h:78
virtual bool has_key_image(const crypto::key_image &img) const override
check if a key image is stored as spent
Definition testdb.h:112
virtual bool get_txpool_tx_blob(const crypto::hash &txid, cryptonote::blobdata &bd, relay_category tx_category) const override
get a txpool transaction's blob
Definition testdb.h:136
virtual std::vector< cryptonote::block > get_blocks_range(const uint64_t &h1, const uint64_t &h2) const override
fetch a list of blocks
Definition testdb.h:90
virtual cryptonote::blobdata get_txpool_tx_blob(const crypto::hash &txid, relay_category tx_category) const override
get a txpool transaction's blob
Definition testdb.h:138
virtual bool tx_exists(const crypto::hash &h, uint64_t &tx_index) const override
Definition testdb.h:96
virtual uint64_t add_transaction_data(const crypto::hash &blk_hash, const std::pair< cryptonote::transaction, cryptonote::blobdata_ref > &tx, const crypto::hash &tx_hash, const crypto::hash &tx_prunable_hash) override
Definition testdb.h:114
virtual std::vector< std::string > get_filenames() const override
get all files used by the BlockchainDB (if any)
Definition testdb.h:50
virtual void unlock() override
This function releases the BlockchainDB lock.
Definition testdb.h:54
virtual void block_wtxn_start() override
Definition testdb.h:59
virtual uint64_t get_tx_unlock_time(const crypto::hash &h) const override
fetch a transaction's unlock time/height
Definition testdb.h:97
virtual uint64_t get_txpool_tx_count(relay_category tx_relay=relay_category::broadcasted) const override
get the number of transactions in the txpool
Definition testdb.h:132
virtual bool for_all_alt_blocks(std::function< bool(const crypto::hash &blkid, const alt_block_data_t &data, const cryptonote::blobdata_ref *blob)> f, bool include_blob=false) const override
runs a function over all alternative blocks stored
Definition testdb.h:168
virtual bool for_all_txpool_txes(std::function< bool(const crypto::hash &, const cryptonote::txpool_tx_meta_t &, const cryptonote::blobdata_ref *)>, bool include_blob=false, relay_category category=relay_category::broadcasted) const override
Definition testdb.h:139
virtual void add_txpool_tx(const crypto::hash &txid, const cryptonote::blobdata_ref &blob, const cryptonote::txpool_tx_meta_t &details) override
add a txpool transaction
Definition testdb.h:130
virtual bool for_all_outputs(std::function< bool(uint64_t amount, const crypto::hash &tx_hash, uint64_t height, size_t tx_idx)> f) const override
runs a function over all outputs stored
Definition testdb.h:124
virtual bool get_pruned_tx_blob(const crypto::hash &h, cryptonote::blobdata &tx) const override
fetches the pruned transaction blob with the given hash
Definition testdb.h:71
virtual bool get_prunable_tx_hash(const crypto::hash &tx_hash, crypto::hash &prunable_hash) const override
fetches the prunable transaction hash
Definition testdb.h:75
virtual size_t get_block_weight(const uint64_t &height) const override
fetch a block's weight
Definition testdb.h:81
virtual bool get_blocks_from(uint64_t start_height, size_t min_block_count, size_t max_block_count, size_t max_tx_count, size_t max_size, std::vector< std::pair< std::pair< cryptonote::blobdata, crypto::hash >, std::vector< std::pair< crypto::hash, cryptonote::blobdata > > > > &blocks, bool pruned, bool skip_coinbase, bool get_miner_tx_hash) const override
fetches a variable number of blocks and transactions from the given height, in canonical blockchain o...
Definition testdb.h:73
virtual cryptonote::transaction get_tx(const crypto::hash &h) const override
fetches the transaction with the given hash
Definition testdb.h:98
virtual std::vector< uint64_t > get_block_cumulative_rct_outputs(const std::vector< uint64_t > &heights) const override
fetch a block's cumulative number of rct outputs
Definition testdb.h:79
virtual void block_wtxn_abort() override
Definition testdb.h:61
virtual void update_txpool_tx(const crypto::hash &txid, const cryptonote::txpool_tx_meta_t &details) override
update a txpool transaction's metadata
Definition testdb.h:131
virtual std::vector< cryptonote::transaction > get_tx_list(const std::vector< crypto::hash > &hlist) const override
fetches a list of transactions based on their hashes
Definition testdb.h:101
virtual std::string get_db_name() const override
gets the name of the folder the BlockchainDB's file(s) should be in
Definition testdb.h:52
virtual uint64_t get_block_already_generated_coins(const uint64_t &height) const override
fetch a block's already generated coins
Definition testdb.h:86
virtual bool get_prunable_tx_blob(const crypto::hash &h, cryptonote::blobdata &tx) const override
fetches the prunable transaction blob with the given hash
Definition testdb.h:74
virtual uint64_t get_alt_block_count() override
get the number of alternative blocks stored
Definition testdb.h:166
virtual void block_wtxn_stop() override
Definition testdb.h:60
virtual std::vector< uint64_t > get_block_weights(uint64_t start_height, size_t count) const override
fetch the last N blocks' weights
Definition testdb.h:82
virtual void block_rtxn_stop() const override
Definition testdb.h:63
virtual void check_hard_fork_info() override
verify hard fork info in database
Definition testdb.h:152
virtual cryptonote::tx_out_index get_output_tx_and_index_from_global(const uint64_t &index) const override
gets an output's tx hash and index
Definition testdb.h:106
virtual void add_max_block_size(uint64_t sz) override
add a new max block size
Definition testdb.h:161
virtual bool for_all_key_images(std::function< bool(const crypto::key_image &)>) const override
runs a function over all key images stored
Definition testdb.h:121
virtual void close() override
close the BlockchainDB
Definition testdb.h:46
virtual bool check_pruning() override
checks pruning was done correctly, iff enabled
Definition testdb.h:157
virtual bool prune_blockchain(uint32_t pruning_seed=0) override
prunes the blockchain
Definition testdb.h:155
virtual uint64_t get_block_long_term_weight(const uint64_t &height) const override
fetch a block's long term weight
Definition testdb.h:87
virtual uint32_t get_blockchain_pruning_seed() const override
get the blockchain pruning seed
Definition testdb.h:154
virtual bool txpool_has_tx(const crypto::hash &txid, relay_category tx_category) const override
check whether a txid is in the txpool and meets tx_category requirements
Definition testdb.h:133
virtual bool for_all_transactions(std::function< bool(const crypto::hash &, const cryptonote::transaction &)>, bool pruned) const override
runs a function over all transactions stored
Definition testdb.h:123
virtual void prune_outputs(uint64_t amount) override
prune output data for the given amount
Definition testdb.h:158
virtual uint8_t get_hard_fork_version(uint64_t height) const override
checks which hardfork version a height is on
Definition testdb.h:151
virtual uint64_t get_num_outputs(const uint64_t &amount) const override
fetches the number of outputs of a given amount
Definition testdb.h:103
virtual void batch_abort() override
aborts a batch transaction
Definition testdb.h:57
virtual void safesyncmode(const bool onoff) override
toggle safe syncs for the DB
Definition testdb.h:48
virtual bool tx_exists(const crypto::hash &h) const override
check if a transaction with a given hash exists
Definition testdb.h:95
virtual bool get_tx_blob(const crypto::hash &h, cryptonote::blobdata &tx) const override
fetches the transaction blob with the given hash
Definition testdb.h:70
virtual 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) const override
return a histogram of outputs on the blockchain
Definition testdb.h:127
virtual void add_spent_key(const crypto::key_image &k_image) override
store a spent key
Definition testdb.h:118
virtual void drop_alt_blocks() override
drop all alternative blocks
Definition testdb.h:167
virtual bool get_txpool_tx_meta(const crypto::hash &txid, cryptonote::txpool_tx_meta_t &meta) const override
get a txpool transaction's metadata
Definition testdb.h:135
virtual void batch_stop() override
ends a batch transaction
Definition testdb.h:56
virtual std::vector< uint64_t > get_long_term_block_weights(uint64_t start_height, size_t count) const override
fetch the last N blocks' long term weights
Definition testdb.h:88
virtual void correct_block_cumulative_difficulties(const uint64_t &start_height, const std::vector< difficulty_type > &new_cumulative_difficulties) override
correct blocks cumulative difficulties that were incorrectly calculated due to the 'difficulty drift'...
Definition testdb.h:85
virtual void remove_alt_block(const crypto::hash &blkid) override
remove an alternative block
Definition testdb.h:165
virtual bool get_pruned_tx_blobs_from(const crypto::hash &h, size_t count, std::vector< cryptonote::blobdata > &bd) const override
fetches a number of pruned transaction blob from the given hash, in canonical blockchain order
Definition testdb.h:72
virtual void drop_hard_fork_info() override
delete hard fork info from database
Definition testdb.h:66
virtual void block_rtxn_abort() const override
Definition testdb.h:64
virtual cryptonote::blobdata get_block_blob_from_height(const uint64_t &height) const override
fetch a block blob by height
Definition testdb.h:68
virtual void add_alt_block(const crypto::hash &blkid, const cryptonote::alt_block_data_t &data, const cryptonote::blobdata_ref &blob) override
add a new alternative block
Definition testdb.h:163
virtual uint64_t add_output(const crypto::hash &tx_hash, const cryptonote::tx_out &tx_output, const uint64_t &local_index, const uint64_t unlock_time, const rct::key *commitment) override
store an output
Definition testdb.h:116
virtual void remove_spent_key(const crypto::key_image &k_image) override
remove a spent key
Definition testdb.h:119
virtual cryptonote::block get_block_from_height(const uint64_t &height) const override
fetch a block by height
Definition testdb.h:149
virtual bool for_all_outputs(uint64_t amount, const std::function< bool(uint64_t height)> &f) const override
Definition testdb.h:125
virtual bool block_rtxn_start() const override
Definition testdb.h:62
BaseTestDB()
Definition testdb.h:44
virtual cryptonote::block get_top_block() const override
fetch the top block
Definition testdb.h:93
The BlockchainDB backing store interface declaration/contract.
Definition blockchain_db.h:379
Definition cryptonote_basic.h:205
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
static int version
Definition mdb_load.c:29
Definition base.py:1
Definition block_weight.py:1
Definition blocks.cpp:13
POD_CLASS key_image
Definition crypto.h:95
POD_CLASS hash
Definition hash.h:49
Holds cryptonote related classes and helpers.
Definition blockchain_db.cpp:45
boost::multiprecision::uint128_t difficulty_type
Definition difficulty.h:41
relay_category
Definition blockchain_db.h:110
@ broadcasted
Public txes received via block/fluff.
Definition blockchain_db.h:111
@ block
Received in block, takes precedence over others.
Definition enums.h:43
std::string blobdata
Definition blobdatatype.h:39
std::pair< crypto::hash, uint64_t > tx_out_index
Definition blockchain_db.h:104
bool t_serializable_object_to_blob(const t_object &to, blobdata &b_blob)
Definition cryptonote_format_utils.h:165
boost::string_ref blobdata_ref
Definition blobdatatype.h:40
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 blockchain_db.h:143
Definition cryptonote_basic.h:458
Definition cryptonote_basic.h:475
a struct containing output metadata
Definition blockchain_db.h:125
Definition cryptonote_basic.h:158
a struct containing txpool per transaction metadata
Definition blockchain_db.h:155
Definition rctTypes.h:79
std::string data
Definition base58.cpp:37
cryptonote::transaction tx
Definition transaction.cpp:40