Electroneum
Loading...
Searching...
No Matches
cryptonote::BlockchainDB Class Referenceabstract

The BlockchainDB backing store interface declaration/contract. More...

#include <blockchain_db.h>

Inheritance diagram for cryptonote::BlockchainDB:
Collaboration diagram for cryptonote::BlockchainDB:

Public Member Functions

virtual void add_addr_tx (const crypto::hash tx_hash, const crypto::public_key &combined_key)=0
virtual void remove_addr_tx (const crypto::hash tx_hash, const crypto::public_key &combined_key)=0
 BlockchainDB ()
 An empty constructor.
virtual ~BlockchainDB ()
 An empty destructor.
void reset_stats ()
 reset profiling stats
void show_stats ()
 show profiling stats
virtual void open (const std::string &filename, const int db_flags=0)=0
 open a db, or create it if necessary.
bool is_open () const
 Gets the current open/ready state of the BlockchainDB.
virtual void close ()=0
 close the BlockchainDB
virtual void sync ()=0
 sync the BlockchainDB with disk
virtual void safesyncmode (const bool onoff)=0
 toggle safe syncs for the DB
virtual void reset ()=0
 Remove everything from the BlockchainDB.
virtual std::vector< std::string > get_filenames () const =0
 get all files used by the BlockchainDB (if any)
virtual bool remove_data_file (const std::string &folder) const =0
 remove file(s) storing the database
virtual std::string get_db_name () const =0
 gets the name of the folder the BlockchainDB's file(s) should be in
virtual bool lock ()=0
 acquires the BlockchainDB lock
virtual void unlock ()=0
 This function releases the BlockchainDB lock.
virtual bool batch_start (uint64_t batch_num_blocks=0, uint64_t batch_bytes=0)=0
 tells the BlockchainDB to start a new "batch" of blocks
virtual void batch_stop ()=0
 ends a batch transaction
virtual void batch_abort ()=0
 aborts a batch transaction
virtual void set_batch_transactions (bool)=0
 sets whether or not to batch transactions
virtual void block_wtxn_start ()=0
virtual void block_wtxn_stop ()=0
virtual void block_wtxn_abort ()=0
virtual bool block_rtxn_start () const =0
virtual void block_rtxn_stop () const =0
virtual void block_rtxn_abort () const =0
virtual void set_hard_fork (HardFork *hf)
virtual uint64_t add_block (const std::pair< block, blobdata > &blk, size_t block_weight, uint64_t long_term_block_weight, const difficulty_type &cumulative_difficulty, const uint64_t &coins_generated, const std::vector< std::pair< transaction, blobdata > > &txs)
 handles the addition of a new block to BlockchainDB
virtual bool block_exists (const crypto::hash &h, uint64_t *height=NULL) const =0
 checks if a block exists
virtual cryptonote::blobdata get_block_blob (const crypto::hash &h) const =0
 fetches the block with the given hash
virtual block get_block (const crypto::hash &h) const
 fetches the block with the given hash
virtual uint64_t get_block_height (const crypto::hash &h) const =0
 gets the height of the block with a given hash
virtual block_header get_block_header (const crypto::hash &h) const =0
 fetch a block header
virtual cryptonote::blobdata get_block_blob_from_height (const uint64_t &height) const =0
 fetch a block blob by height
virtual block get_block_from_height (const uint64_t &height) const
 fetch a block by height
virtual uint64_t get_block_timestamp (const uint64_t &height) const =0
 fetch a block's timestamp
virtual std::vector< uint64_tget_block_cumulative_rct_outputs (const std::vector< uint64_t > &heights) const =0
 fetch a block's cumulative number of rct outputs
virtual uint64_t get_top_block_timestamp () const =0
 fetch the top block's timestamp
virtual size_t get_block_weight (const uint64_t &height) const =0
 fetch a block's weight
virtual std::vector< uint64_tget_block_weights (uint64_t start_height, size_t count) const =0
 fetch the last N blocks' weights
virtual void set_block_cumulative_difficulty (uint64_t height, difficulty_type diff)=0
 sets a block's cumulative difficulty
virtual difficulty_type get_block_cumulative_difficulty (const uint64_t &height) const =0
 fetch a block's cumulative difficulty
virtual difficulty_type get_block_difficulty (const uint64_t &height) const =0
 fetch a block's difficulty
virtual uint64_t get_block_already_generated_coins (const uint64_t &height) const =0
 fetch a block's already generated coins
virtual uint64_t get_block_long_term_weight (const uint64_t &height) const =0
 fetch a block's long term weight
virtual std::vector< uint64_tget_long_term_block_weights (uint64_t start_height, size_t count) const =0
 fetch the last N blocks' long term weights
virtual crypto::hash get_block_hash_from_height (const uint64_t &height) const =0
 fetch a block's hash
virtual std::vector< blockget_blocks_range (const uint64_t &h1, const uint64_t &h2) const =0
 fetch a list of blocks
virtual std::vector< crypto::hashget_hashes_range (const uint64_t &h1, const uint64_t &h2) const =0
 fetch a list of block hashes
virtual crypto::hash top_block_hash (uint64_t *block_height=NULL) const =0
 fetch the top block's hash
virtual block get_top_block () const =0
 fetch the top block
virtual uint64_t height () const =0
 fetch the current blockchain height
virtual void pop_block (block &blk, std::vector< transaction > &txs)
 pops the top block off the blockchain
virtual bool tx_exists (const crypto::hash &h) const =0
 check if a transaction with a given hash exists
virtual bool tx_exists (const crypto::hash &h, uint64_t &tx_id) const =0
virtual uint64_t get_tx_unlock_time (const crypto::hash &h) const =0
 fetch a transaction's unlock time/height
virtual transaction get_tx (const crypto::hash &h) const
 fetches the transaction with the given hash
virtual transaction get_pruned_tx (const crypto::hash &h) const
 fetches the transaction base with the given hash
virtual bool get_tx (const crypto::hash &h, transaction &tx) const
 fetches the transaction with the given hash
virtual bool get_pruned_tx (const crypto::hash &h, transaction &tx) const
 fetches the transaction base with the given hash
virtual bool get_tx_blob (const crypto::hash &h, cryptonote::blobdata &tx) const =0
 fetches the transaction blob with the given hash
virtual bool get_pruned_tx_blob (const crypto::hash &h, cryptonote::blobdata &tx) const =0
 fetches the pruned transaction blob with the given hash
virtual bool get_prunable_tx_blob (const crypto::hash &h, cryptonote::blobdata &tx) const =0
 fetches the prunable transaction blob with the given hash
virtual bool get_prunable_tx_hash (const crypto::hash &tx_hash, crypto::hash &prunable_hash) const =0
 fetches the prunable transaction hash
virtual uint64_t get_tx_count () const =0
 fetches the total number of transactions ever
virtual std::vector< transactionget_tx_list (const std::vector< crypto::hash > &hlist) const =0
 fetches a list of transactions based on their hashes
virtual uint64_t get_tx_block_height (const crypto::hash &h) const =0
 fetches the height of a transaction's block
virtual uint64_t get_num_outputs (const uint64_t &amount) const =0
 fetches the number of outputs of a given amount
virtual uint64_t get_indexing_base () const
 return index of the first element (should be hidden, but isn't)
virtual output_data_t get_output_key (const uint64_t &amount, const uint64_t &index, bool include_commitmemt=true) const =0
 get some of an output's data
virtual tx_out_index get_output_tx_and_index_from_global (const uint64_t &index) const =0
 gets an output's tx hash and index
virtual tx_out_index get_output_tx_and_index (const uint64_t &amount, const uint64_t &index) const =0
 gets an output's tx hash and index
virtual void get_output_tx_and_index (const uint64_t &amount, const std::vector< uint64_t > &offsets, std::vector< tx_out_index > &indices) const =0
 gets some outputs' tx hashes and indices
virtual void get_output_key (const epee::span< const uint64_t > &amounts, const std::vector< uint64_t > &offsets, std::vector< output_data_t > &outputs, bool allow_partial=false) const =0
 gets outputs' data
virtual bool can_thread_bulk_indices () const =0
virtual std::vector< std::vector< uint64_t > > get_tx_amount_output_indices (const uint64_t tx_id, size_t n_txes=1) const =0
 gets output indices (amount-specific) for a transaction's outputs
virtual bool has_key_image (const crypto::key_image &img) const =0
 check if a key image is stored as spent
virtual void add_txpool_tx (const crypto::hash &txid, const cryptonote::blobdata &blob, const txpool_tx_meta_t &details)=0
 add a txpool transaction
virtual void update_txpool_tx (const crypto::hash &txid, const txpool_tx_meta_t &details)=0
 update a txpool transaction's metadata
virtual uint64_t get_txpool_tx_count (bool include_unrelayed_txes=true) const =0
 get the number of transactions in the txpool
virtual bool txpool_has_tx (const crypto::hash &txid) const =0
 check whether a txid is in the txpool
virtual void remove_txpool_tx (const crypto::hash &txid)=0
 remove a txpool transaction
virtual bool get_txpool_tx_meta (const crypto::hash &txid, txpool_tx_meta_t &meta) const =0
 get a txpool transaction's metadata
virtual bool get_txpool_tx_blob (const crypto::hash &txid, cryptonote::blobdata &bd) const =0
 get a txpool transaction's blob
virtual cryptonote::blobdata get_txpool_tx_blob (const crypto::hash &txid) const =0
 get a txpool transaction's blob
virtual void prune_outputs (uint64_t amount)=0
 prune output data for the given amount
virtual uint32_t get_blockchain_pruning_seed () const =0
 get the blockchain pruning seed
virtual bool prune_blockchain (uint32_t pruning_seed=0)=0
 prunes the blockchain
virtual bool update_pruning ()=0
 prunes recent blockchain changes as needed, iff pruning is enabled
virtual bool check_pruning ()=0
 checks pruning was done correctly, iff enabled
virtual uint64_t get_max_block_size ()=0
 get the max block size
virtual void add_max_block_size (uint64_t sz)=0
 add a new max block size
virtual bool for_all_txpool_txes (std::function< bool(const crypto::hash &, const txpool_tx_meta_t &, const cryptonote::blobdata *)>, bool include_blob=false, bool include_unrelayed_txes=true) const =0
 runs a function over all txpool transactions
virtual bool for_all_key_images (std::function< bool(const crypto::key_image &)>) const =0
 runs a function over all key images stored
virtual bool for_blocks_range (const uint64_t &h1, const uint64_t &h2, std::function< bool(uint64_t, const crypto::hash &, const cryptonote::block &)>) const =0
 runs a function over a range of blocks
virtual bool for_all_transactions (std::function< bool(const crypto::hash &, const cryptonote::transaction &)>, bool pruned) const =0
 runs a function over all transactions stored
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 =0
 runs a function over all outputs stored
virtual bool for_all_outputs (uint64_t amount, const std::function< bool(uint64_t height)> &f) const =0
virtual void set_hard_fork_version (uint64_t height, uint8_t version)=0
 sets which hardfork version a height is on
virtual uint8_t get_hard_fork_version (uint64_t height) const =0
 checks which hardfork version a height is on
virtual void set_validator_list (std::string, uint32_t expiration_date)=0
virtual std::string get_validator_list () const =0
virtual void check_hard_fork_info ()=0
 verify hard fork info in database
virtual void drop_hard_fork_info ()=0
 delete hard fork info from database
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 =0
 return a histogram of outputs on the blockchain
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 =0
virtual bool is_read_only () const =0
 is BlockchainDB in read-only mode?
virtual uint64_t get_database_size () const =0
 get disk space requirements
virtual void fixup ()
 fix up anything that may be wrong due to past bugs
void set_auto_remove_logs (bool auto_remove)
 set whether or not to automatically remove logs
virtual bool check_chainstate_utxo (const crypto::hash tx_hash, const uint32_t relative_out_index)=0
virtual uint64_t get_utxo_unlock_time (const crypto::hash tx_hash, const uint32_t relative_out_index)=0
virtual std::vector< address_outputsget_addr_output_all (const crypto::public_key &combined_key)=0
virtual std::vector< address_outputsget_addr_output_batch (const crypto::public_key &combined_key, uint64_t start_db_index=0, uint64_t batch_size=100, bool desc=false)=0
virtual std::vector< address_txsget_addr_tx_all (const crypto::public_key &combined_key)=0
virtual std::vector< address_txsget_addr_tx_batch (const crypto::public_key &combined_key, uint64_t start_db_index=0, uint64_t batch_size=100, bool desc=false)=0
virtual uint64_t get_balance (const crypto::public_key &combined_key)=0
virtual tx_input_t get_tx_input (const crypto::hash tx_hash, const uint32_t relative_out_index)=0

Static Public Member Functions

static void init_options (boost::program_options::options_description &desc)
 init command line options

Public Attributes

bool m_open
 Whether or not the BlockchainDB is open/ready for use.
epee::critical_section m_synchronization_lock
 A lock, currently for when BlockchainLMDB needs to resize the backing db file.

Protected Member Functions

void add_transaction (const crypto::hash &blk_hash, const std::pair< transaction, blobdata > &tx, const crypto::hash *tx_hash_ptr=NULL, const crypto::hash *tx_prunable_hash_ptr=NULL)
 helper function for add_transactions, to add each individual transaction

Protected Attributes

uint64_t time_tx_exists = 0
 a performance metric
uint64_t time_commit1 = 0
 a performance metric
bool m_auto_remove_logs = true
 whether or not to automatically remove old logs
HardForkm_hardfork

Detailed Description

The BlockchainDB backing store interface declaration/contract.

This class provides a uniform interface for using BlockchainDB to store a blockchain. Any implementation of this class will also implement all functions exposed here, so one can use this class without knowing what implementation is being used. Refer to each pure virtual function's documentation here when implementing a BlockchainDB subclass.

A subclass which encounters an issue should report that issue by throwing a DB_EXCEPTION which adequately conveys the issue.

Definition at line 402 of file blockchain_db.h.

Constructor & Destructor Documentation

◆ BlockchainDB()

cryptonote::BlockchainDB::BlockchainDB ( )
inline

An empty constructor.

Definition at line 617 of file blockchain_db.h.

617: m_hardfork(NULL), m_open(false) { }
bool m_open
Whether or not the BlockchainDB is open/ready for use.
Here is the caller graph for this function:

◆ ~BlockchainDB()

virtual cryptonote::BlockchainDB::~BlockchainDB ( )
inlinevirtual

An empty destructor.

Definition at line 622 of file blockchain_db.h.

622{ };

Member Function Documentation

◆ add_addr_tx()

virtual void cryptonote::BlockchainDB::add_addr_tx ( const crypto::hash tx_hash,
const crypto::public_key & combined_key )
pure virtual
Here is the caller graph for this function:

◆ add_block()

uint64_t cryptonote::BlockchainDB::add_block ( const std::pair< block, blobdata > & blk,
size_t block_weight,
uint64_t long_term_block_weight,
const difficulty_type & cumulative_difficulty,
const uint64_t & coins_generated,
const std::vector< std::pair< transaction, blobdata > > & txs )
virtual

handles the addition of a new block to BlockchainDB

This function organizes block addition and calls various functions as necessary.

NOTE: subclass implementations of this (or the functions it calls) need to handle undoing any partially-added blocks in the event of a failure.

If any of this cannot be done, the subclass should throw the corresponding subclass of DB_EXCEPTION

Parameters
blkthe block to be added
block_weightthe size of the block (transactions and all)
long_term_block_weightthe long term weight of the block (transactions and all)
cumulative_difficultythe accumulated difficulty after this block
coins_generatedthe number of coins generated total after this block
txsthe transactions in the block
Returns
the height of the chain post-addition

Reimplemented in cryptonote::BlockchainLMDB.

Definition at line 269 of file blockchain_db.cpp.

276{
277 const block &blk = blck.first;
278
279 // sanity
280 if (blk.tx_hashes.size() != txs.size())
281 throw std::runtime_error("Inconsistent tx/hashes sizes");
282
283 TIME_MEASURE_START(time1);
284 crypto::hash blk_hash = get_block_hash(blk);
285 TIME_MEASURE_FINISH(time1);
286 time_blk_hash += time1;
287
288 uint64_t prev_height = height();
289
290 // call out to add the transactions
291
293
294 add_transaction(blk_hash, std::make_pair(blk.miner_tx, tx_to_blob(blk.miner_tx)));
295 int tx_i = 0;
296 crypto::hash tx_hash = crypto::null_hash;
297 for (const std::pair<transaction, blobdata>& tx : txs)
298 {
299 tx_hash = blk.tx_hashes[tx_i];
300 add_transaction(blk_hash, tx, &tx_hash);
301 ++tx_i;
302 }
303 TIME_MEASURE_FINISH(time1);
304 time_add_transaction += time1;
305
306 // call out to subclass implementation to add the block & metadata
308 add_block(blk, block_weight, long_term_block_weight, cumulative_difficulty, coins_generated, 0, blk_hash);
309 TIME_MEASURE_FINISH(time1);
310 time_add_block1 += time1;
311 //voting mechanism
312 m_hardfork->add(blk, prev_height);
313
314 ++num_calls;
315
316 return prev_height;
317}
virtual uint64_t height() const =0
fetch the current blockchain height
void add_transaction(const crypto::hash &blk_hash, const std::pair< transaction, blobdata > &tx, const crypto::hash *tx_hash_ptr=NULL, const crypto::hash *tx_prunable_hash_ptr=NULL)
helper function for add_transactions, to add each individual transaction
POD_CLASS hash
Definition hash.h:50
bool get_block_hash(const block &b, crypto::hash &res)
blobdata tx_to_blob(const transaction &tx)
uint64_t get_tick_count()
#define TIME_MEASURE_FINISH(var_name)
#define TIME_MEASURE_START(var_name)
unsigned __int64 uint64_t
Definition stdint.h:136
Here is the call graph for this function:

◆ add_max_block_size()

virtual void cryptonote::BlockchainDB::add_max_block_size ( uint64_t sz)
pure virtual

add a new max block size

The max block size will be the maximum of sz and the current block size

Parameters
sz the block size

◆ add_transaction()

void cryptonote::BlockchainDB::add_transaction ( const crypto::hash & blk_hash,
const std::pair< transaction, blobdata > & tx,
const crypto::hash * tx_hash_ptr = NULL,
const crypto::hash * tx_prunable_hash_ptr = NULL )
protected

helper function for add_transactions, to add each individual transaction

This function is called by add_transactions() for each transaction to be added.

Parameters
blk_hashhash of the block which has the transaction
txthe transaction to add
tx_hash_ptrthe hash of the transaction, if already calculated
tx_prunable_hash_ptrthe hash of the prunable part of the transaction, if already calculated

Definition at line 133 of file blockchain_db.cpp.

134{
135 const transaction &tx = txp.first;
136
137 bool miner_tx = false;
138 crypto::hash tx_hash, tx_prunable_hash;
139 if (!tx_hash_ptr)
140 {
141 // should only need to compute hash for miner transactions
142 tx_hash = get_transaction_hash(tx);
143 LOG_PRINT_L3("null tx_hash_ptr - needed to compute: " << tx_hash);
144 }
145 else
146 {
147 tx_hash = *tx_hash_ptr;
148 }
149
150 std::vector<std::pair<crypto::hash, uint64_t>> utxos_to_remove;
151 // keep a set of the etn addresses (derived from BOTH ins and outs) associated with the tx for removal from addr_tx db
152 std::unordered_set<cryptonote::account_public_address> addr_tx_addresses;
153
154 // Sanity check on supported input types
155 for (size_t i = 0; i < tx.vin.size(); ++i)
156 {
157 const txin_v& tx_input = tx.vin[i];
158 if (tx_input.type() == typeid(txin_to_key))
159 {
160 add_spent_key(boost::get<txin_to_key>(tx_input).k_image);
161 }
162 else if (tx_input.type() == typeid(txin_to_key_public))
163 {
164 const auto &txin = boost::get<txin_to_key_public>(tx_input);
165 utxos_to_remove.push_back({txin.tx_hash, txin.relative_offset});
166 add_tx_input(txin.tx_hash, txin.relative_offset, tx.hash, i);
167
168 //work for addr_tx db
169 transaction parent_tx = get_tx(txin.tx_hash);
170 const auto &txout = boost::get<txout_to_key_public>(parent_tx.vout[txin.relative_offset].target); //previous tx out that this tx in references
171 if(addr_tx_addresses.find(txout.address) == addr_tx_addresses.end()){ //if addr hasn't been used for another input yet, add the unique addr tx record for this address
172 add_addr_tx(tx.hash, addKeys(txout.address.m_view_public_key, txout.address.m_spend_public_key));
173 addr_tx_addresses.insert(txout.address);
174 }
175 }
176 else if (tx_input.type() == typeid(txin_gen))
177 {
178 /* nothing to do here */
179 miner_tx = true;
180 }
181 else
182 {
183 LOG_PRINT_L1("Unsupported input type, removing key images and aborting transaction addition");
184 for (const txin_v& tx_input : tx.vin)
185 {
186 if (tx_input.type() == typeid(txin_to_key))
187 {
188 remove_spent_key(boost::get<txin_to_key>(tx_input).k_image); // inputs are already checked here regardless of version
189 }
190 if (tx_input.type() == typeid(txin_to_key_public)) {
191 //rewind tx inputs added to tx input db if the transaction aborts
192 const auto &txin = boost::get<txin_to_key_public>(tx_input);
193 remove_tx_input(txin.tx_hash, txin.relative_offset);
194 //work for addr_tx db
195 transaction parent_tx = get_tx(txin.tx_hash);
196 const auto &txout = boost::get<txout_to_key_public>(parent_tx.vout[txin.relative_offset].target); //previous tx out that this tx in references
197 if (addr_tx_addresses.find(txout.address) != addr_tx_addresses.end()) { // dont do a remove for every input. there is only one entry per address per tx in the addr tx db
198 remove_addr_tx(tx.hash, addKeys(txout.address.m_view_public_key, txout.address.m_spend_public_key));
199 addr_tx_addresses.erase(txout.address);
200 }
201 }
202 }
203 return;
204 }
205 }
206
207 if (tx.version == 1)
208 {
209 uint64_t tx_id = add_transaction_data(blk_hash, txp, tx_hash, tx_prunable_hash);
210
211 std::vector<uint64_t> amount_output_indices(tx.vout.size());
212
213 // iterate tx.vout using indices instead of C++11 foreach syntax because
214 // we need the index
215 for (uint64_t i = 0; i < tx.vout.size(); ++i)
216 {
217 amount_output_indices[i] = add_output(tx_hash, tx.vout[i], i, tx.unlock_time, NULL);
218 }
219 add_tx_amount_output_indices(tx_id, amount_output_indices);
220 }
221 else if (tx.version >= 2)
222 {
223 add_transaction_data(blk_hash, txp, tx_hash, tx_prunable_hash);
224
225 // Sanity check on supported output types
226 for (uint64_t i = 0; i < tx.vout.size(); ++i)
227 {
228 if(tx.vout[i].target.type() != typeid(txout_to_key_public))
229 {
230 LOG_PRINT_L1("Unsupported output type, reinstating UTXOs, removing key images and aborting transaction addition");
231 for (const txin_v& tx_input : tx.vin) {
232 if (tx_input.type() == typeid(txin_to_key)) {
233 remove_spent_key(boost::get<txin_to_key>(tx_input).k_image);
234 }
235 if (tx_input.type() == typeid(txin_to_key_public)) {
236 //rewind tx inputs added to tx input db if the transaction aborts
237 const auto &txin = boost::get<txin_to_key_public>(tx_input);
238 remove_tx_input(txin.tx_hash, txin.relative_offset);
239 //work for addr_tx db
240 transaction parent_tx = get_tx(txin.tx_hash);
241 const auto &txout = boost::get<txout_to_key_public>(
242 parent_tx.vout[txin.relative_offset].target); //previous tx out that this tx in references
243 if (addr_tx_addresses.find(txout.address) !=
244 addr_tx_addresses.end()) { // dont do a remove for every input, only a remove for every addr that was uniquely added to the addr tx db
245 remove_addr_tx(tx.hash, addKeys(txout.address.m_view_public_key, txout.address.m_spend_public_key));
246 addr_tx_addresses.erase(txout.address);
247 }
248 }
249 }
250 return;
251 }// if outs are all of the right type, we're ok to proceed by removing the utxos that are now spent
252
253 for(auto utxo: utxos_to_remove)
254 {
255 remove_chainstate_utxo(utxo.first, utxo.second);
256 }
257
258 const auto &txout = boost::get<txout_to_key_public>(tx.vout[i].target);
259 add_chainstate_utxo(tx.hash, i, addKeys(txout.address.m_view_public_key, txout.address.m_spend_public_key) , tx.vout[i].amount, txp.first.unlock_time, miner_tx);
260 add_addr_output(tx.hash, i, addKeys(txout.address.m_view_public_key, txout.address.m_spend_public_key), tx.vout[i].amount, txp.first.unlock_time);
261 if(addr_tx_addresses.find(txout.address) == addr_tx_addresses.end()){ //if addr hasn't been used for another input yet, add the unique addr tx record for this address
262 add_addr_tx(tx.hash, addKeys(txout.address.m_view_public_key, txout.address.m_spend_public_key));
263 addr_tx_addresses.insert(txout.address);
264 }
265 }//end of v2+ processing
266 }
267}
virtual void add_addr_tx(const crypto::hash tx_hash, const crypto::public_key &combined_key)=0
virtual transaction get_tx(const crypto::hash &h) const
fetches the transaction with the given hash
virtual void remove_addr_tx(const crypto::hash tx_hash, const crypto::public_key &combined_key)=0
#define LOG_PRINT_L3(x)
#define LOG_PRINT_L1(x)
public_key addKeys(const public_key &A, const public_key &B)
Definition crypto.h:339
boost::variant< txin_gen, txin_to_script, txin_to_scripthash, txin_to_key, txin_to_key_public > txin_v
crypto::hash get_transaction_hash(const transaction &t)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_txpool_tx()

virtual void cryptonote::BlockchainDB::add_txpool_tx ( const crypto::hash & txid,
const cryptonote::blobdata & blob,
const txpool_tx_meta_t & details )
pure virtual

add a txpool transaction

Parameters
detailsthe details of the transaction to add

Implemented in cryptonote::BlockchainLMDB.

◆ batch_abort()

virtual void cryptonote::BlockchainDB::batch_abort ( )
pure virtual

aborts a batch transaction

If the subclass implements batching, this function should abort the batch it is currently on.

If no batch is in-progress, this function should throw a DB_ERROR. This exception may change in the future if it is deemed necessary to have a more granular exception type for this scenario.

If any of this cannot be done, the subclass should throw the corresponding subclass of DB_EXCEPTION

Implemented in cryptonote::BlockchainLMDB.

◆ batch_start()

virtual bool cryptonote::BlockchainDB::batch_start ( uint64_t batch_num_blocks = 0,
uint64_t batch_bytes = 0 )
pure virtual

tells the BlockchainDB to start a new "batch" of blocks

If the subclass implements a batching method of caching blocks in RAM to be added to a backing store in groups, it should start a batch which will end either when <batch_num_blocks> has been added or batch_stop() has been called. In either case, it should end the batch and write to its backing store.

If a batch is already in-progress, this function must return false. If a batch was started by this call, it must return true.

If any of this cannot be done, the subclass should throw the corresponding subclass of DB_EXCEPTION

Parameters
batch_num_blocksnumber of blocks to batch together
Returns
true if we started the batch, false if already started

Implemented in cryptonote::BlockchainLMDB.

Here is the caller graph for this function:

◆ batch_stop()

virtual void cryptonote::BlockchainDB::batch_stop ( )
pure virtual

ends a batch transaction

If the subclass implements batching, this function should store the batch it is currently on and mark it finished.

If no batch is in-progress, this function should throw a DB_ERROR. This exception may change in the future if it is deemed necessary to have a more granular exception type for this scenario.

If any of this cannot be done, the subclass should throw the corresponding subclass of DB_EXCEPTION

Implemented in cryptonote::BlockchainLMDB.

Here is the caller graph for this function:

◆ block_exists()

virtual bool cryptonote::BlockchainDB::block_exists ( const crypto::hash & h,
uint64_t * height = NULL ) const
pure virtual

checks if a block exists

Parameters
hthe hash of the requested block
heightif non NULL, returns the block's height if found
Returns
true of the block exists, otherwise false

Implemented in cryptonote::BlockchainLMDB.

Here is the call graph for this function:

◆ block_rtxn_abort()

virtual void cryptonote::BlockchainDB::block_rtxn_abort ( ) const
pure virtual

Implemented in cryptonote::BlockchainLMDB.

◆ block_rtxn_start()

virtual bool cryptonote::BlockchainDB::block_rtxn_start ( ) const
pure virtual

Implemented in cryptonote::BlockchainLMDB.

◆ block_rtxn_stop()

virtual void cryptonote::BlockchainDB::block_rtxn_stop ( ) const
pure virtual

Implemented in cryptonote::BlockchainLMDB.

◆ block_wtxn_abort()

virtual void cryptonote::BlockchainDB::block_wtxn_abort ( )
pure virtual

Implemented in cryptonote::BlockchainLMDB.

◆ block_wtxn_start()

virtual void cryptonote::BlockchainDB::block_wtxn_start ( )
pure virtual

Implemented in cryptonote::BlockchainLMDB.

◆ block_wtxn_stop()

virtual void cryptonote::BlockchainDB::block_wtxn_stop ( )
pure virtual

Implemented in cryptonote::BlockchainLMDB.

◆ can_thread_bulk_indices()

virtual bool cryptonote::BlockchainDB::can_thread_bulk_indices ( ) const
pure virtual

Implemented in cryptonote::BlockchainLMDB.

◆ check_chainstate_utxo()

virtual bool cryptonote::BlockchainDB::check_chainstate_utxo ( const crypto::hash tx_hash,
const uint32_t relative_out_index )
pure virtual

◆ check_hard_fork_info()

virtual void cryptonote::BlockchainDB::check_hard_fork_info ( )
pure virtual

verify hard fork info in database

◆ check_pruning()

virtual bool cryptonote::BlockchainDB::check_pruning ( )
pure virtual

checks pruning was done correctly, iff enabled

Returns
success iff true

Implemented in cryptonote::BlockchainLMDB.

◆ close()

virtual void cryptonote::BlockchainDB::close ( )
pure virtual

close the BlockchainDB

At minimum, this call ensures that further use of the BlockchainDB instance will not have effect. In any case where it is necessary to do so, a subclass implementing this will sync with disk.

If any of this cannot be done, the subclass should throw the corresponding subclass of DB_EXCEPTION

Implemented in cryptonote::BlockchainLMDB.

◆ drop_hard_fork_info()

virtual void cryptonote::BlockchainDB::drop_hard_fork_info ( )
pure virtual

delete hard fork info from database

Here is the caller graph for this function:

◆ fixup()

void cryptonote::BlockchainDB::fixup ( )
virtual

fix up anything that may be wrong due to past bugs

Definition at line 489 of file blockchain_db.cpp.

490{
491 if (is_read_only()) {
492 LOG_PRINT_L1("Database is opened read only - skipping fixup check");
493 return;
494 }
495
496 // Apply fixes to DB if needed.
497
498 batch_stop();
499}
virtual void batch_stop()=0
ends a batch transaction
virtual bool is_read_only() const =0
is BlockchainDB in read-only mode?
Here is the call graph for this function:

◆ for_all_key_images()

virtual bool cryptonote::BlockchainDB::for_all_key_images ( std::function< bool(const crypto::key_image &)> ) const
pure virtual

runs a function over all key images stored

The subclass should run the passed function for each key image it has stored, passing the key image as its parameter.

If any call to the function returns false, the subclass should return false. Otherwise, the subclass returns true.

Parameters
std::functionfn the function to run
Returns
false if the function returns false for any key image, otherwise true

Implemented in cryptonote::BlockchainLMDB.

◆ for_all_outputs() [1/2]

virtual bool cryptonote::BlockchainDB::for_all_outputs ( std::function< bool(uint64_t amount, const crypto::hash &tx_hash, uint64_t height, size_t tx_idx)> f) const
pure virtual

runs a function over all outputs stored

The subclass should run the passed function for each output it has stored, passing (amount, transaction_hash, tx_local_output_index) as its parameters.

If any call to the function returns false, the subclass should return false. Otherwise, the subclass returns true.

The subclass should throw DB_ERROR if any of the expected values are not found. Current implementations simply return false.

Parameters
std::functionf the function to run
Returns
false if the function returns false for any output, otherwise true

Implemented in cryptonote::BlockchainLMDB.

Here is the call graph for this function:

◆ for_all_outputs() [2/2]

virtual bool cryptonote::BlockchainDB::for_all_outputs ( uint64_t amount,
const std::function< bool(uint64_t height)> & f ) const
pure virtual

Implemented in cryptonote::BlockchainLMDB.

Here is the call graph for this function:

◆ for_all_transactions()

virtual bool cryptonote::BlockchainDB::for_all_transactions ( std::function< bool(const crypto::hash &, const cryptonote::transaction &)> ,
bool pruned ) const
pure virtual

runs a function over all transactions stored

The subclass should run the passed function for each transaction it has stored, passing (transaction_hash, transaction) as its parameters.

If any call to the function returns false, the subclass should return false. Otherwise, the subclass returns true.

The subclass should throw DB_ERROR if any of the expected values are not found. Current implementations simply return false.

Parameters
std::functionfn the function to run
boolpruned whether to only get pruned tx data, or the whole
Returns
false if the function returns false for any transaction, otherwise true

Implemented in cryptonote::BlockchainLMDB.

Here is the caller graph for this function:

◆ for_all_txpool_txes()

virtual bool cryptonote::BlockchainDB::for_all_txpool_txes ( std::function< bool(const crypto::hash &, const txpool_tx_meta_t &, const cryptonote::blobdata *)> ,
bool include_blob = false,
bool include_unrelayed_txes = true ) const
pure virtual

runs a function over all txpool transactions

The subclass should run the passed function for each txpool tx it has stored, passing the tx id and metadata as its parameters.

If any call to the function returns false, the subclass should return false. Otherwise, the subclass returns true.

Parameters
std::functionfn the function to run
Returns
false if the function returns false for any transaction, otherwise true

Implemented in cryptonote::BlockchainLMDB.

◆ for_blocks_range()

virtual bool cryptonote::BlockchainDB::for_blocks_range ( const uint64_t & h1,
const uint64_t & h2,
std::function< bool(uint64_t, const crypto::hash &, const cryptonote::block &)>  ) const
pure virtual

runs a function over a range of blocks

The subclass should run the passed function for each block in the specified range, passing (block_height, block_hash, block) as its parameters.

If any call to the function returns false, the subclass should return false. Otherwise, the subclass returns true.

The subclass should throw DB_ERROR if any of the expected values are not found. Current implementations simply return false.

Parameters
h1the start height
h2the end height
std::functionfn the function to run
Returns
false if the function returns false for any block, otherwise true

Implemented in cryptonote::BlockchainLMDB.

◆ get_addr_output_all()

virtual std::vector< address_outputs > cryptonote::BlockchainDB::get_addr_output_all ( const crypto::public_key & combined_key)
pure virtual

Implemented in cryptonote::BlockchainLMDB.

◆ get_addr_output_batch()

virtual std::vector< address_outputs > cryptonote::BlockchainDB::get_addr_output_batch ( const crypto::public_key & combined_key,
uint64_t start_db_index = 0,
uint64_t batch_size = 100,
bool desc = false )
pure virtual

Implemented in cryptonote::BlockchainLMDB.

◆ get_addr_tx_all()

virtual std::vector< address_txs > cryptonote::BlockchainDB::get_addr_tx_all ( const crypto::public_key & combined_key)
pure virtual

Implemented in cryptonote::BlockchainLMDB.

◆ get_addr_tx_batch()

virtual std::vector< address_txs > cryptonote::BlockchainDB::get_addr_tx_batch ( const crypto::public_key & combined_key,
uint64_t start_db_index = 0,
uint64_t batch_size = 100,
bool desc = false )
pure virtual

Implemented in cryptonote::BlockchainLMDB.

◆ get_balance()

virtual uint64_t cryptonote::BlockchainDB::get_balance ( const crypto::public_key & combined_key)
pure virtual

Implemented in cryptonote::BlockchainLMDB.

◆ get_block()

block cryptonote::BlockchainDB::get_block ( const crypto::hash & h) const
virtual

fetches the block with the given hash

Returns the requested block.

If the block does not exist, the subclass should throw BLOCK_DNE

Parameters
hthe hash to look for
Returns
the block requested

Definition at line 409 of file blockchain_db.cpp.

410{
411 blobdata bd = get_block_blob(h);
412 block b;
414 throw DB_ERROR("Failed to parse block from blob retrieved from the db");
415
416 return b;
417}
virtual cryptonote::blobdata get_block_blob(const crypto::hash &h) const =0
fetches the block with the given hash
bool parse_and_validate_block_from_blob(const blobdata &b_blob, block &b, crypto::hash *block_hash)
std::string blobdata
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_block_already_generated_coins()

virtual uint64_t cryptonote::BlockchainDB::get_block_already_generated_coins ( const uint64_t & height) const
pure virtual

fetch a block's already generated coins

The subclass should return the total coins generated as of the block with the given height.

If the block does not exist, the subclass should throw BLOCK_DNE

Parameters
heightthe height requested
Returns
the already generated coins

Implemented in cryptonote::BlockchainLMDB.

Here is the call graph for this function:

◆ get_block_blob()

virtual cryptonote::blobdata cryptonote::BlockchainDB::get_block_blob ( const crypto::hash & h) const
pure virtual

fetches the block with the given hash

The subclass should return the requested block.

If the block does not exist, the subclass should throw BLOCK_DNE

Parameters
hthe hash to look for
Returns
the block requested

Implemented in cryptonote::BlockchainLMDB.

Here is the caller graph for this function:

◆ get_block_blob_from_height()

virtual cryptonote::blobdata cryptonote::BlockchainDB::get_block_blob_from_height ( const uint64_t & height) const
pure virtual

fetch a block blob by height

The subclass should return the block at the given height.

If the block does not exist, that is to say if the blockchain is not that high, then the subclass should throw BLOCK_DNE

Parameters
heightthe height to look for
Returns
the block blob

Implemented in cryptonote::BlockchainLMDB.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_block_cumulative_difficulty()

virtual difficulty_type cryptonote::BlockchainDB::get_block_cumulative_difficulty ( const uint64_t & height) const
pure virtual

fetch a block's cumulative difficulty

The subclass should return the cumulative difficulty of the block with the given height.

If the block does not exist, the subclass should throw BLOCK_DNE

Parameters
heightthe height requested
Returns
the cumulative difficulty

Implemented in cryptonote::BlockchainLMDB.

Here is the call graph for this function:

◆ get_block_cumulative_rct_outputs()

virtual std::vector< uint64_t > cryptonote::BlockchainDB::get_block_cumulative_rct_outputs ( const std::vector< uint64_t > & heights) const
pure virtual

fetch a block's cumulative number of rct outputs

The subclass should return the numer of rct outputs in the blockchain up to the block with the given height (inclusive).

If the block does not exist, the subclass should throw BLOCK_DNE

Parameters
heightthe height requested
Returns
the cumulative number of rct outputs

Implemented in cryptonote::BlockchainLMDB.

◆ get_block_difficulty()

virtual difficulty_type cryptonote::BlockchainDB::get_block_difficulty ( const uint64_t & height) const
pure virtual

fetch a block's difficulty

The subclass should return the difficulty of the block with the given height.

If the block does not exist, the subclass should throw BLOCK_DNE

Parameters
heightthe height requested
Returns
the difficulty

Implemented in cryptonote::BlockchainLMDB.

Here is the call graph for this function:

◆ get_block_from_height()

block cryptonote::BlockchainDB::get_block_from_height ( const uint64_t & height) const
virtual

fetch a block by height

If the block does not exist, that is to say if the blockchain is not that high, then the subclass should throw BLOCK_DNE

Parameters
heightthe height to look for
Returns
the block

Definition at line 399 of file blockchain_db.cpp.

400{
402 block b;
404 throw DB_ERROR("Failed to parse block from blob retrieved from the db");
405
406 return b;
407}
virtual cryptonote::blobdata get_block_blob_from_height(const uint64_t &height) const =0
fetch a block blob by height
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_block_hash_from_height()

virtual crypto::hash cryptonote::BlockchainDB::get_block_hash_from_height ( const uint64_t & height) const
pure virtual

fetch a block's hash

The subclass should return hash of the block with the given height.

If the block does not exist, the subclass should throw BLOCK_DNE

Parameters
heightthe height requested
Returns
the hash

Implemented in cryptonote::BlockchainLMDB.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_block_header()

virtual block_header cryptonote::BlockchainDB::get_block_header ( const crypto::hash & h) const
pure virtual

fetch a block header

The subclass should return the block header from the block with the given hash.

If the block does not exist, the subclass should throw BLOCK_DNE

Parameters
hthe hash to look for
Returns
the block header

Implemented in cryptonote::BlockchainLMDB.

◆ get_block_height()

virtual uint64_t cryptonote::BlockchainDB::get_block_height ( const crypto::hash & h) const
pure virtual

gets the height of the block with a given hash

The subclass should return the requested height.

If the block does not exist, the subclass should throw BLOCK_DNE

Parameters
hthe hash to look for
Returns
the height

Implemented in cryptonote::BlockchainLMDB.

◆ get_block_long_term_weight()

virtual uint64_t cryptonote::BlockchainDB::get_block_long_term_weight ( const uint64_t & height) const
pure virtual

fetch a block's long term weight

If the block does not exist, the subclass should throw BLOCK_DNE

Parameters
heightthe height requested
Returns
the long term weight

Implemented in cryptonote::BlockchainLMDB.

Here is the call graph for this function:

◆ get_block_timestamp()

virtual uint64_t cryptonote::BlockchainDB::get_block_timestamp ( const uint64_t & height) const
pure virtual

fetch a block's timestamp

The subclass should return the timestamp of the block with the given height.

If the block does not exist, the subclass should throw BLOCK_DNE

Parameters
heightthe height requested
Returns
the timestamp

Implemented in cryptonote::BlockchainLMDB.

Here is the call graph for this function:

◆ get_block_weight()

virtual size_t cryptonote::BlockchainDB::get_block_weight ( const uint64_t & height) const
pure virtual

fetch a block's weight

The subclass should return the weight of the block with the given height.

If the block does not exist, the subclass should throw BLOCK_DNE

Parameters
heightthe height requested
Returns
the weight

Implemented in cryptonote::BlockchainLMDB.

Here is the call graph for this function:

◆ get_block_weights()

virtual std::vector< uint64_t > cryptonote::BlockchainDB::get_block_weights ( uint64_t start_height,
size_t count ) const
pure virtual

fetch the last N blocks' weights

If there are fewer than N blocks, the returned array will be smaller than N

Parameters
countthe number of blocks requested
Returns
the weights

Implemented in cryptonote::BlockchainLMDB.

◆ get_blockchain_pruning_seed()

virtual uint32_t cryptonote::BlockchainDB::get_blockchain_pruning_seed ( ) const
pure virtual

get the blockchain pruning seed

Returns
the blockchain pruning seed

Implemented in cryptonote::BlockchainLMDB.

◆ get_blocks_range()

virtual std::vector< block > cryptonote::BlockchainDB::get_blocks_range ( const uint64_t & h1,
const uint64_t & h2 ) const
pure virtual

fetch a list of blocks

The subclass should return a vector of blocks with heights starting at h1 and ending at h2, inclusively.

If the height range requested goes past the end of the blockchain, the subclass should throw BLOCK_DNE. (current implementations simply don't catch this exception as thrown by methods called within)

Parameters
h1the start height
h2the end height
Returns
a vector of blocks

Implemented in cryptonote::BlockchainLMDB.

◆ get_database_size()

virtual uint64_t cryptonote::BlockchainDB::get_database_size ( ) const
pure virtual

get disk space requirements

Returns
the size required

◆ get_db_name()

virtual std::string cryptonote::BlockchainDB::get_db_name ( ) const
pure virtual

gets the name of the folder the BlockchainDB's file(s) should be in

The subclass implementation should return the name of the folder in which it stores files, or an empty string if there is none.

Returns
the name of the folder with the BlockchainDB's files, if any.

Implemented in cryptonote::BlockchainLMDB.

Here is the caller graph for this function:

◆ get_filenames()

virtual std::vector< std::string > cryptonote::BlockchainDB::get_filenames ( ) const
pure virtual

get all files used by the BlockchainDB (if any)

This function is largely for ease of automation, namely for unit tests.

The subclass implementation should return all filenames it uses.

Returns
a list of filenames

Implemented in cryptonote::BlockchainLMDB.

◆ get_hard_fork_version()

virtual uint8_t cryptonote::BlockchainDB::get_hard_fork_version ( uint64_t height) const
pure virtual

checks which hardfork version a height is on

Parameters
heightthe height
Returns
the version
Here is the call graph for this function:

◆ get_hashes_range()

virtual std::vector< crypto::hash > cryptonote::BlockchainDB::get_hashes_range ( const uint64_t & h1,
const uint64_t & h2 ) const
pure virtual

fetch a list of block hashes

The subclass should return a vector of block hashes from blocks with heights starting at h1 and ending at h2, inclusively.

If the height range requested goes past the end of the blockchain, the subclass should throw BLOCK_DNE. (current implementations simply don't catch this exception as thrown by methods called within)

Parameters
h1the start height
h2the end height
Returns
a vector of block hashes

Implemented in cryptonote::BlockchainLMDB.

◆ get_indexing_base()

virtual uint64_t cryptonote::BlockchainDB::get_indexing_base ( ) const
inlinevirtual

return index of the first element (should be hidden, but isn't)

Returns
the index

Definition at line 1420 of file blockchain_db.h.

1420{ return 0; }

◆ get_long_term_block_weights()

virtual std::vector< uint64_t > cryptonote::BlockchainDB::get_long_term_block_weights ( uint64_t start_height,
size_t count ) const
pure virtual

fetch the last N blocks' long term weights

If there are fewer than N blocks, the returned array will be smaller than N

Parameters
countthe number of blocks requested
Returns
the weights

Implemented in cryptonote::BlockchainLMDB.

◆ get_max_block_size()

virtual uint64_t cryptonote::BlockchainDB::get_max_block_size ( )
pure virtual

get the max block size

◆ get_num_outputs()

virtual uint64_t cryptonote::BlockchainDB::get_num_outputs ( const uint64_t & amount) const
pure virtual

fetches the number of outputs of a given amount

The subclass should return a count of outputs of the given amount, or zero if there are none.

Parameters
amountthe output amount being looked up
Returns
the number of outputs of the given amount

Implemented in cryptonote::BlockchainLMDB.

Here is the caller graph for this function:

◆ get_output_distribution()

virtual bool cryptonote::BlockchainDB::get_output_distribution ( uint64_t amount,
uint64_t from_height,
uint64_t to_height,
std::vector< uint64_t > & distribution,
uint64_t & base ) const
pure virtual

Implemented in cryptonote::BlockchainLMDB.

◆ get_output_histogram()

virtual std::map< uint64_t, std::tuple< uint64_t, uint64_t, uint64_t > > cryptonote::BlockchainDB::get_output_histogram ( const std::vector< uint64_t > & amounts,
bool unlocked,
uint64_t recent_cutoff,
uint64_t min_count ) const
pure virtual

return a histogram of outputs on the blockchain

Parameters
amountsoptional set of amounts to lookup
unlockedwhether to restrict count to unlocked outputs
recent_cutofftimestamp to determine whether an output is recent
min_countreturn only amounts with at least that many instances
Returns
a set of amount/instances

Implemented in cryptonote::BlockchainLMDB.

◆ get_output_key() [1/2]

virtual void cryptonote::BlockchainDB::get_output_key ( const epee::span< const uint64_t > & amounts,
const std::vector< uint64_t > & offsets,
std::vector< output_data_t > & outputs,
bool allow_partial = false ) const
pure virtual

gets outputs' data

This function is a mirror of get_output_data(const uint64_t& amount, const uint64_t& index) but for a list of outputs rather than just one.

Parameters
amountsan output amount, or as many as offsets
offsetsa list of amount-specific output indices
outputsreturn-by-reference a list of outputs' metadata

Implemented in cryptonote::BlockchainLMDB.

◆ get_output_key() [2/2]

virtual output_data_t cryptonote::BlockchainDB::get_output_key ( const uint64_t & amount,
const uint64_t & index,
bool include_commitmemt = true ) const
pure virtual

get some of an output's data

The subclass should return the public key, unlock time, and block height for the output with the given amount and index, collected in a struct.

If the output cannot be found, the subclass should throw OUTPUT_DNE.

If any of these parts cannot be found, but some are, the subclass should throw DB_ERROR with a message stating as much.

Parameters
amountthe output amount
indexthe output's index (indexed by amount)
Returns
the requested output data

Implemented in cryptonote::BlockchainLMDB.

Here is the caller graph for this function:

◆ get_output_tx_and_index() [1/2]

virtual void cryptonote::BlockchainDB::get_output_tx_and_index ( const uint64_t & amount,
const std::vector< uint64_t > & offsets,
std::vector< tx_out_index > & indices ) const
pure virtual

gets some outputs' tx hashes and indices

This function is a mirror of get_output_tx_and_index(const uint64_t& amount, const uint64_t& index), but for a list of outputs rather than just one.

Parameters
amountan output amount
offsetsa list of amount-specific output indices
indicesreturn-by-reference a list of tx hashes and output indices (as pairs)

Implemented in cryptonote::BlockchainLMDB.

◆ get_output_tx_and_index() [2/2]

virtual tx_out_index cryptonote::BlockchainDB::get_output_tx_and_index ( const uint64_t & amount,
const uint64_t & index ) const
pure virtual

gets an output's tx hash and index

The subclass should return the hash of the transaction which created the output with the amount and index given, as well as its index in that transaction.

Parameters
amountan output amount
indexan output's amount-specific index
Returns
the tx hash and output index

Implemented in cryptonote::BlockchainLMDB.

◆ get_output_tx_and_index_from_global()

virtual tx_out_index cryptonote::BlockchainDB::get_output_tx_and_index_from_global ( const uint64_t & index) const
pure virtual

gets an output's tx hash and index

The subclass should return the hash of the transaction which created the output with the global index given, as well as its index in that transaction.

Parameters
indexan output's global index
Returns
the tx hash and output index

Implemented in cryptonote::BlockchainLMDB.

◆ get_prunable_tx_blob()

virtual bool cryptonote::BlockchainDB::get_prunable_tx_blob ( const crypto::hash & h,
cryptonote::blobdata & tx ) const
pure virtual

fetches the prunable transaction blob with the given hash

The subclass should return the prunable transaction stored which has the given hash.

If the transaction does not exist, or if we do not have that prunable data, the subclass should return false.

Parameters
hthe hash to look for
Returns
true iff the transaction was found and we have its prunable data

Implemented in cryptonote::BlockchainLMDB.

◆ get_prunable_tx_hash()

virtual bool cryptonote::BlockchainDB::get_prunable_tx_hash ( const crypto::hash & tx_hash,
crypto::hash & prunable_hash ) const
pure virtual

fetches the prunable transaction hash

The subclass should return the hash of the prunable transaction data.

If the transaction hash does not exist, the subclass should return false.

Parameters
hthe tx hash to look for
Returns
true iff the transaction was found

Implemented in cryptonote::BlockchainLMDB.

◆ get_pruned_tx() [1/2]

transaction cryptonote::BlockchainDB::get_pruned_tx ( const crypto::hash & h) const
virtual

fetches the transaction base with the given hash

If the transaction does not exist, the subclass should throw TX_DNE.

Parameters
hthe hash to look for
Returns
the transaction with the given hash

Definition at line 449 of file blockchain_db.cpp.

450{
451 transaction tx;
452 if (!get_pruned_tx(h, tx))
453 throw TX_DNE(std::string("pruned tx with hash ").append(epee::string_tools::pod_to_hex(h)).append(" not found in db").c_str());
454 return tx;
455}
virtual transaction get_pruned_tx(const crypto::hash &h) const
fetches the transaction base with the given hash
std::string pod_to_hex(const t_pod_type &s)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_pruned_tx() [2/2]

bool cryptonote::BlockchainDB::get_pruned_tx ( const crypto::hash & h,
cryptonote::transaction & tx ) const
virtual

fetches the transaction base with the given hash

If the transaction does not exist, the subclass should return false.

Parameters
hthe hash to look for
Returns
true iff the transaction was found

Definition at line 430 of file blockchain_db.cpp.

431{
432 blobdata bd;
433 if (!get_pruned_tx_blob(h, bd))
434 return false;
436 throw DB_ERROR("Failed to parse transaction base from blob retrieved from the db");
437
438 return true;
439}
virtual bool get_pruned_tx_blob(const crypto::hash &h, cryptonote::blobdata &tx) const =0
fetches the pruned transaction blob with the given hash
bool parse_and_validate_tx_base_from_blob(const blobdata &tx_blob, transaction &tx)
Here is the call graph for this function:

◆ get_pruned_tx_blob()

virtual bool cryptonote::BlockchainDB::get_pruned_tx_blob ( const crypto::hash & h,
cryptonote::blobdata & tx ) const
pure virtual

fetches the pruned transaction blob with the given hash

The subclass should return the pruned transaction stored which has the given hash.

If the transaction does not exist, the subclass should return false.

Parameters
hthe hash to look for
Returns
true iff the transaction was found

Implemented in cryptonote::BlockchainLMDB.

Here is the caller graph for this function:

◆ get_top_block()

virtual block cryptonote::BlockchainDB::get_top_block ( ) const
pure virtual

fetch the top block

The subclass should return most recent block

Returns
the top block

Implemented in cryptonote::BlockchainLMDB.

Here is the caller graph for this function:

◆ get_top_block_timestamp()

virtual uint64_t cryptonote::BlockchainDB::get_top_block_timestamp ( ) const
pure virtual

fetch the top block's timestamp

The subclass should return the timestamp of the most recent block.

Returns
the top block's timestamp

Implemented in cryptonote::BlockchainLMDB.

◆ get_tx() [1/2]

transaction cryptonote::BlockchainDB::get_tx ( const crypto::hash & h) const
virtual

fetches the transaction with the given hash

If the transaction does not exist, the subclass should throw TX_DNE.

Parameters
hthe hash to look for
Returns
the transaction with the given hash

Definition at line 441 of file blockchain_db.cpp.

442{
443 transaction tx;
444 if (!get_tx(h, tx))
445 throw TX_DNE(std::string("tx with hash ").append(epee::string_tools::pod_to_hex(h)).append(" not found in db").c_str());
446 return tx;
447}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_tx() [2/2]

bool cryptonote::BlockchainDB::get_tx ( const crypto::hash & h,
cryptonote::transaction & tx ) const
virtual

fetches the transaction with the given hash

If the transaction does not exist, the subclass should return false.

Parameters
hthe hash to look for
Returns
true iff the transaction was found

Definition at line 419 of file blockchain_db.cpp.

420{
421 blobdata bd;
422 if (!get_tx_blob(h, bd))
423 return false;
425 throw DB_ERROR("Failed to parse transaction from blob retrieved from the db");
426
427 return true;
428}
virtual bool get_tx_blob(const crypto::hash &h, cryptonote::blobdata &tx) const =0
fetches the transaction blob with the given hash
bool parse_and_validate_tx_from_blob(const blobdata &tx_blob, transaction &tx)
Here is the call graph for this function:

◆ get_tx_amount_output_indices()

virtual std::vector< std::vector< uint64_t > > cryptonote::BlockchainDB::get_tx_amount_output_indices ( const uint64_t tx_id,
size_t n_txes = 1 ) const
pure virtual

gets output indices (amount-specific) for a transaction's outputs

The subclass should fetch the amount-specific output indices for each output in the transaction with the given ID.

If the transaction does not exist, the subclass should throw TX_DNE.

If an output cannot be found, the subclass should throw OUTPUT_DNE.

Parameters
tx_ida transaction ID
n_txeshow many txes to get data for, starting with tx_id
Returns
a list of amount-specific output indices

Implemented in cryptonote::BlockchainLMDB.

◆ get_tx_blob()

virtual bool cryptonote::BlockchainDB::get_tx_blob ( const crypto::hash & h,
cryptonote::blobdata & tx ) const
pure virtual

fetches the transaction blob with the given hash

The subclass should return the transaction stored which has the given hash.

If the transaction does not exist, the subclass should return false.

Parameters
hthe hash to look for
Returns
true iff the transaction was found

Implemented in cryptonote::BlockchainLMDB.

Here is the caller graph for this function:

◆ get_tx_block_height()

virtual uint64_t cryptonote::BlockchainDB::get_tx_block_height ( const crypto::hash & h) const
pure virtual

fetches the height of a transaction's block

The subclass should attempt to return the height of the block containing the transaction with the given hash.

If the transaction cannot be found, the subclass should throw TX_DNE.

Parameters
hthe hash of the transaction
Returns
the height of the transaction's block

Implemented in cryptonote::BlockchainLMDB.

◆ get_tx_count()

virtual uint64_t cryptonote::BlockchainDB::get_tx_count ( ) const
pure virtual

fetches the total number of transactions ever

The subclass should return a count of all the transactions from all blocks.

Returns
the number of transactions in the blockchain

Implemented in cryptonote::BlockchainLMDB.

◆ get_tx_input()

virtual tx_input_t cryptonote::BlockchainDB::get_tx_input ( const crypto::hash tx_hash,
const uint32_t relative_out_index )
pure virtual

Implemented in cryptonote::BlockchainLMDB.

◆ get_tx_list()

virtual std::vector< transaction > cryptonote::BlockchainDB::get_tx_list ( const std::vector< crypto::hash > & hlist) const
pure virtual

fetches a list of transactions based on their hashes

The subclass should attempt to fetch each transaction referred to by the hashes passed.

Currently, if any of the transactions is not in BlockchainDB, the call to get_tx in the implementation will throw TX_DNE.

Parameters
hlista list of hashes
Returns
the list of transactions

Implemented in cryptonote::BlockchainLMDB.

◆ get_tx_unlock_time()

virtual uint64_t cryptonote::BlockchainDB::get_tx_unlock_time ( const crypto::hash & h) const
pure virtual

fetch a transaction's unlock time/height

The subclass should return the stored unlock time for the transaction with the given hash.

If no such transaction exists, the subclass should throw TX_DNE.

Parameters
hthe hash of the requested transaction
Returns
the unlock time/height

Implemented in cryptonote::BlockchainLMDB.

◆ get_txpool_tx_blob() [1/2]

virtual cryptonote::blobdata cryptonote::BlockchainDB::get_txpool_tx_blob ( const crypto::hash & txid) const
pure virtual

get a txpool transaction's blob

Parameters
txidthe transaction id of the transation to lookup
Returns
the blob for that transaction

Implemented in cryptonote::BlockchainLMDB.

◆ get_txpool_tx_blob() [2/2]

virtual bool cryptonote::BlockchainDB::get_txpool_tx_blob ( const crypto::hash & txid,
cryptonote::blobdata & bd ) const
pure virtual

get a txpool transaction's blob

Parameters
txidthe transaction id of the transation to lookup
bdthe blob to return
Returns
true if the txid was in the txpool, false otherwise

Implemented in cryptonote::BlockchainLMDB.

◆ get_txpool_tx_count()

virtual uint64_t cryptonote::BlockchainDB::get_txpool_tx_count ( bool include_unrelayed_txes = true) const
pure virtual

get the number of transactions in the txpool

Implemented in cryptonote::BlockchainLMDB.

◆ get_txpool_tx_meta()

virtual bool cryptonote::BlockchainDB::get_txpool_tx_meta ( const crypto::hash & txid,
txpool_tx_meta_t & meta ) const
pure virtual

get a txpool transaction's metadata

Parameters
txidthe transaction id of the transation to lookup
metathe metadata to return
Returns
true if the tx meta was found, false otherwise

Implemented in cryptonote::BlockchainLMDB.

◆ get_utxo_unlock_time()

virtual uint64_t cryptonote::BlockchainDB::get_utxo_unlock_time ( const crypto::hash tx_hash,
const uint32_t relative_out_index )
pure virtual

◆ get_validator_list()

virtual std::string cryptonote::BlockchainDB::get_validator_list ( ) const
pure virtual

◆ has_key_image()

virtual bool cryptonote::BlockchainDB::has_key_image ( const crypto::key_image & img) const
pure virtual

check if a key image is stored as spent

Parameters
imgthe key image to check for
Returns
true if the image is present, otherwise false

Implemented in cryptonote::BlockchainLMDB.

◆ height()

virtual uint64_t cryptonote::BlockchainDB::height ( ) const
pure virtual

fetch the current blockchain height

The subclass should return the current blockchain height

Returns
the current blockchain height

Implemented in cryptonote::BlockchainLMDB.

Here is the caller graph for this function:

◆ init_options()

void cryptonote::BlockchainDB::init_options ( boost::program_options::options_description & desc)
static

init command line options

Definition at line 118 of file blockchain_db.cpp.

119{
124}
void add_arg(boost::program_options::options_description &description, const arg_descriptor< T, required, dependent, NUM_DEPS > &arg, bool unique=true)
const command_line::arg_descriptor< bool > arg_db_salvage
const command_line::arg_descriptor< bool > arg_addr_db_salvage
const command_line::arg_descriptor< std::string > arg_db_type
const command_line::arg_descriptor< std::string > arg_db_sync_mode
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_open()

bool cryptonote::BlockchainDB::is_open ( ) const

Gets the current open/ready state of the BlockchainDB.

Returns
true if open/ready, otherwise false

Definition at line 341 of file blockchain_db.cpp.

342{
343 return m_open;
344}
Here is the caller graph for this function:

◆ is_read_only()

virtual bool cryptonote::BlockchainDB::is_read_only ( ) const
pure virtual

is BlockchainDB in read-only mode?

Returns
true if in read-only mode, otherwise false
Here is the caller graph for this function:

◆ lock()

virtual bool cryptonote::BlockchainDB::lock ( )
pure virtual

acquires the BlockchainDB lock

This function is a stub until such a time as locking is implemented at this level.

The subclass implementation should return true unless implementing a locking scheme of some sort, in which case it should return true upon acquisition of the lock and block until then.

If any of this cannot be done, the subclass should throw the corresponding subclass of DB_EXCEPTION

Returns
true, unless at a future time false makes sense (timeout, etc)

Implemented in cryptonote::BlockchainLMDB.

◆ open()

virtual void cryptonote::BlockchainDB::open ( const std::string & filename,
const int db_flags = 0 )
pure virtual

open a db, or create it if necessary.

This function opens an existing database or creates it if it does not exist.

The subclass implementing this will handle all file opening/creation, and is responsible for maintaining its state.

The parameter <filename> may not refer to a file name, necessarily, but could be an IP:PORT for a database which needs it, and so on. Calling it <filename> is convenient and should be descriptive enough, however.

For now, db_flags are specific to the subclass being instantiated. This is subject to change, and the db_flags parameter may be deprecated.

If any of this cannot be done, the subclass should throw the corresponding subclass of DB_EXCEPTION

Parameters
filenamea string referring to the BlockchainDB to open
db_flagsflags relevant to how to open/use the BlockchainDB

Implemented in cryptonote::BlockchainLMDB.

Here is the caller graph for this function:

◆ pop_block()

void cryptonote::BlockchainDB::pop_block ( block & blk,
std::vector< transaction > & txs )
virtual

pops the top block off the blockchain

The subclass should remove the most recent block from the blockchain, along with all transactions, outputs, and other metadata created as a result of its addition to the blockchain. Most of this is handled by the concrete members of the base class provided the subclass correctly implements remove_* functions.

The subclass should return by reference the popped block and its associated transactions

Parameters
blkreturn-by-reference the block which was popped
txsreturn-by-reference the transactions from the popped block

Reimplemented in cryptonote::BlockchainLMDB.

Definition at line 324 of file blockchain_db.cpp.

325{
326 blk = get_top_block();
327
328 remove_block();
329
330 for (const auto& h : boost::adaptors::reverse(blk.tx_hashes))
331 {
332 cryptonote::transaction tx;
333 if (!get_tx(h, tx) && !get_pruned_tx(h, tx))
334 throw DB_ERROR("Failed to get pruned or unpruned transaction from the db");
335 txs.push_back(std::move(tx));
336 remove_transaction(h);
337 }
338 remove_transaction(get_transaction_hash(blk.miner_tx));
339}
virtual block get_top_block() const =0
fetch the top block
Here is the call graph for this function:

◆ prune_blockchain()

virtual bool cryptonote::BlockchainDB::prune_blockchain ( uint32_t pruning_seed = 0)
pure virtual

prunes the blockchain

Parameters
pruning_seedthe seed to use, 0 for default (highly recommended)
Returns
success iff true

Implemented in cryptonote::BlockchainLMDB.

◆ prune_outputs()

virtual void cryptonote::BlockchainDB::prune_outputs ( uint64_t amount)
pure virtual

prune output data for the given amount

Parameters
amountthe amount for which to prune data
Here is the caller graph for this function:

◆ remove_addr_tx()

virtual void cryptonote::BlockchainDB::remove_addr_tx ( const crypto::hash tx_hash,
const crypto::public_key & combined_key )
pure virtual
Here is the caller graph for this function:

◆ remove_data_file()

virtual bool cryptonote::BlockchainDB::remove_data_file ( const std::string & folder) const
pure virtual

remove file(s) storing the database

This function is for resetting the database (for core tests, functional tests, etc). The function reset() is not usable because it needs to open the database file first which can fail if the existing database file is in an incompatible format. As such, this function needs to be called before calling open().

Parameters
folderThe path of the folder containing the database file(s) which must not end with slash '/'.
Returns
true if the operation is succesfull

Implemented in cryptonote::BlockchainLMDB.

◆ remove_txpool_tx()

virtual void cryptonote::BlockchainDB::remove_txpool_tx ( const crypto::hash & txid)
pure virtual

remove a txpool transaction

Parameters
txidthe transaction id of the transation to remove

Implemented in cryptonote::BlockchainLMDB.

◆ reset()

virtual void cryptonote::BlockchainDB::reset ( )
pure virtual

Remove everything from the BlockchainDB.

This function should completely remove all data from a BlockchainDB.

Use with caution!

If any of this cannot be done, the subclass should throw the corresponding subclass of DB_EXCEPTION

Implemented in cryptonote::BlockchainLMDB.

◆ reset_stats()

void cryptonote::BlockchainDB::reset_stats ( )

reset profiling stats

Definition at line 457 of file blockchain_db.cpp.

458{
459 num_calls = 0;
460 time_blk_hash = 0;
461 time_tx_exists = 0;
462 time_add_block1 = 0;
463 time_add_transaction = 0;
464 time_commit1 = 0;
465}
uint64_t time_tx_exists
a performance metric
uint64_t time_commit1
a performance metric
Here is the caller graph for this function:

◆ safesyncmode()

virtual void cryptonote::BlockchainDB::safesyncmode ( const bool onoff)
pure virtual

toggle safe syncs for the DB

Used to switch DBF_SAFE on or off after starting up with DBF_FAST.

Implemented in cryptonote::BlockchainLMDB.

◆ set_auto_remove_logs()

void cryptonote::BlockchainDB::set_auto_remove_logs ( bool auto_remove)
inline

set whether or not to automatically remove logs

This function is only relevant for one implementation (BlockchainBDB), but is here to keep BlockchainDB users implementation-agnostic.

Parameters
auto_removewhether or not to auto-remove logs

Definition at line 1800 of file blockchain_db.h.

1800{ m_auto_remove_logs = auto_remove; }
bool m_auto_remove_logs
whether or not to automatically remove old logs

◆ set_batch_transactions()

virtual void cryptonote::BlockchainDB::set_batch_transactions ( bool )
pure virtual

sets whether or not to batch transactions

If the subclass implements batching, this function tells it to begin batching automatically.

If the subclass implements batching and has a batch in-progress, a parameter of false should disable batching and call batch_stop() to store the current batch.

If any of this cannot be done, the subclass should throw the corresponding subclass of DB_EXCEPTION

Parameters
boolbatch whether or not to use batch transactions.

Implemented in cryptonote::BlockchainLMDB.

Here is the caller graph for this function:

◆ set_block_cumulative_difficulty()

virtual void cryptonote::BlockchainDB::set_block_cumulative_difficulty ( uint64_t height,
difficulty_type diff )
pure virtual

sets a block's cumulative difficulty

The subclass should return true if the cumulative difficulty is set successfully

If the block does not exist, the subclass should throw BLOCK_DNE

Parameters
heightthe height requested
diffthe cumulative difficulty value to be set
Returns
true | false

Implemented in cryptonote::BlockchainLMDB.

Here is the call graph for this function:

◆ set_hard_fork()

void cryptonote::BlockchainDB::set_hard_fork ( HardFork * hf)
virtual

Definition at line 319 of file blockchain_db.cpp.

320{
321 m_hardfork = hf;
322}

◆ set_hard_fork_version()

virtual void cryptonote::BlockchainDB::set_hard_fork_version ( uint64_t height,
uint8_t version )
pure virtual

sets which hardfork version a height is on

Parameters
heightthe height
versionthe version
Here is the call graph for this function:

◆ set_validator_list()

virtual void cryptonote::BlockchainDB::set_validator_list ( std::string ,
uint32_t expiration_date )
pure virtual

◆ show_stats()

void cryptonote::BlockchainDB::show_stats ( )

show profiling stats

This function prints current performance/profiling data to whichever log file(s) are set up (possibly including stdout or stderr)

Definition at line 467 of file blockchain_db.cpp.

468{
470 << "*********************************"
471 << ENDL
472 << "num_calls: " << num_calls
473 << ENDL
474 << "time_blk_hash: " << time_blk_hash << "ms"
475 << ENDL
476 << "time_tx_exists: " << time_tx_exists << "ms"
477 << ENDL
478 << "time_add_block1: " << time_add_block1 << "ms"
479 << ENDL
480 << "time_add_transaction: " << time_add_transaction << "ms"
481 << ENDL
482 << "time_commit1: " << time_commit1 << "ms"
483 << ENDL
484 << "*********************************"
485 << ENDL
486 );
487}
#define ENDL
Here is the caller graph for this function:

◆ sync()

virtual void cryptonote::BlockchainDB::sync ( )
pure virtual

sync the BlockchainDB with disk

This function should write any changes to whatever permanent backing store the subclass uses. Example: a BlockchainDB instance which keeps the whole blockchain in RAM won't need to regularly access a disk, but should write out its state when this is called.

If any of this cannot be done, the subclass should throw the corresponding subclass of DB_EXCEPTION

Implemented in cryptonote::BlockchainLMDB.

◆ top_block_hash()

virtual crypto::hash cryptonote::BlockchainDB::top_block_hash ( uint64_t * block_height = NULL) const
pure virtual

fetch the top block's hash

The subclass should return the hash of the most recent block

Parameters
block_heightif non NULL, returns the height of that block (ie, the blockchain height minus 1)
Returns
the top block's hash

Implemented in cryptonote::BlockchainLMDB.

◆ tx_exists() [1/2]

virtual bool cryptonote::BlockchainDB::tx_exists ( const crypto::hash & h) const
pure virtual

check if a transaction with a given hash exists

The subclass should check if a transaction is stored which has the given hash and return true if so, false otherwise.

Parameters
hthe hash to check against
tx_id(optional) returns the tx_id for the tx hash
Returns
true if the transaction exists, otherwise false

Implemented in cryptonote::BlockchainLMDB.

◆ tx_exists() [2/2]

virtual bool cryptonote::BlockchainDB::tx_exists ( const crypto::hash & h,
uint64_t & tx_id ) const
pure virtual

Implemented in cryptonote::BlockchainLMDB.

◆ txpool_has_tx()

virtual bool cryptonote::BlockchainDB::txpool_has_tx ( const crypto::hash & txid) const
pure virtual

check whether a txid is in the txpool

Implemented in cryptonote::BlockchainLMDB.

◆ unlock()

virtual void cryptonote::BlockchainDB::unlock ( )
pure virtual

This function releases the BlockchainDB lock.

The subclass, should it have implemented lock(), will release any lock held by the calling thread. In the case of recursive locking, it should release one instance of a lock.

If any of this cannot be done, the subclass should throw the corresponding subclass of DB_EXCEPTION

Implemented in cryptonote::BlockchainLMDB.

◆ update_pruning()

virtual bool cryptonote::BlockchainDB::update_pruning ( )
pure virtual

prunes recent blockchain changes as needed, iff pruning is enabled

Returns
success iff true

Implemented in cryptonote::BlockchainLMDB.

◆ update_txpool_tx()

virtual void cryptonote::BlockchainDB::update_txpool_tx ( const crypto::hash & txid,
const txpool_tx_meta_t & details )
pure virtual

update a txpool transaction's metadata

Parameters
txidthe txid of the transaction to update
detailsthe details of the transaction to update

Implemented in cryptonote::BlockchainLMDB.

Member Data Documentation

◆ m_auto_remove_logs

bool cryptonote::BlockchainDB::m_auto_remove_logs = true
protected

whether or not to automatically remove old logs

Definition at line 606 of file blockchain_db.h.

◆ m_hardfork

HardFork* cryptonote::BlockchainDB::m_hardfork
protected

Definition at line 608 of file blockchain_db.h.

◆ m_open

bool cryptonote::BlockchainDB::m_open

Whether or not the BlockchainDB is open/ready for use.

Definition at line 1804 of file blockchain_db.h.

◆ m_synchronization_lock

epee::critical_section cryptonote::BlockchainDB::m_synchronization_lock
mutable

A lock, currently for when BlockchainLMDB needs to resize the backing db file.

Definition at line 1805 of file blockchain_db.h.

◆ time_commit1

uint64_t cryptonote::BlockchainDB::time_commit1 = 0
protected

a performance metric

Definition at line 605 of file blockchain_db.h.

◆ time_tx_exists

uint64_t cryptonote::BlockchainDB::time_tx_exists = 0
mutableprotected

a performance metric

Definition at line 604 of file blockchain_db.h.


The documentation for this class was generated from the following files:
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/blockchain_db/blockchain_db.h
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/blockchain_db/blockchain_db.cpp