|
Electroneum
|
#include <db_lmdb.h>


Public Member Functions | |
| BlockchainLMDB (bool batch_transactions=true) | |
| ~BlockchainLMDB () | |
| virtual void | open (const std::string &filename, const int mdb_flags=0) |
| open a db, or create it if necessary. More... | |
| virtual void | close () |
| close the BlockchainDB More... | |
| virtual void | sync () |
| sync the BlockchainDB with disk More... | |
| virtual void | safesyncmode (const bool onoff) |
| toggle safe syncs for the DB More... | |
| virtual void | reset () |
| Remove everything from the BlockchainDB. More... | |
| virtual std::vector< std::string > | get_filenames () const |
| get all files used by the BlockchainDB (if any) More... | |
| virtual bool | remove_data_file (const std::string &folder) const |
| remove file(s) storing the database More... | |
| virtual std::string | get_db_name () const |
| gets the name of the folder the BlockchainDB's file(s) should be in More... | |
| virtual bool | lock () |
| acquires the BlockchainDB lock More... | |
| virtual void | unlock () |
| This function releases the BlockchainDB lock. More... | |
| virtual bool | block_exists (const crypto::hash &h, uint64_t *height=NULL) const |
| checks if a block exists More... | |
| virtual uint64_t | get_block_height (const crypto::hash &h) const |
| gets the height of the block with a given hash More... | |
| virtual block_header | get_block_header (const crypto::hash &h) const |
| fetch a block header More... | |
| virtual cryptonote::blobdata | get_block_blob (const crypto::hash &h) const |
| fetches the block with the given hash More... | |
| virtual cryptonote::blobdata | get_block_blob_from_height (const uint64_t &height) const |
| fetch a block blob by height More... | |
| virtual std::vector< uint64_t > | get_block_cumulative_rct_outputs (const std::vector< uint64_t > &heights) const |
| fetch a block's cumulative number of rct outputs More... | |
| virtual uint64_t | get_block_timestamp (const uint64_t &height) const |
| fetch a block's timestamp More... | |
| virtual uint64_t | get_top_block_timestamp () const |
| fetch the top block's timestamp More... | |
| virtual size_t | get_block_weight (const uint64_t &height) const |
| fetch a block's weight More... | |
| virtual std::vector< uint64_t > | get_block_weights (uint64_t start_height, size_t count) const |
| fetch the last N blocks' weights More... | |
| virtual void | set_block_cumulative_difficulty (uint64_t height, difficulty_type diff) |
| sets a block's cumulative difficulty More... | |
| virtual difficulty_type | get_block_cumulative_difficulty (const uint64_t &height) const |
| fetch a block's cumulative difficulty More... | |
| virtual difficulty_type | get_block_difficulty (const uint64_t &height) const |
| fetch a block's difficulty More... | |
| virtual uint64_t | get_block_already_generated_coins (const uint64_t &height) const |
| fetch a block's already generated coins More... | |
| virtual uint64_t | get_block_long_term_weight (const uint64_t &height) const |
| fetch a block's long term weight More... | |
| virtual std::vector< uint64_t > | get_long_term_block_weights (uint64_t start_height, size_t count) const |
| fetch the last N blocks' long term weights More... | |
| virtual crypto::hash | get_block_hash_from_height (const uint64_t &height) const |
| fetch a block's hash More... | |
| virtual std::vector< block > | get_blocks_range (const uint64_t &h1, const uint64_t &h2) const |
| fetch a list of blocks More... | |
| virtual std::vector< crypto::hash > | get_hashes_range (const uint64_t &h1, const uint64_t &h2) const |
| fetch a list of block hashes More... | |
| virtual crypto::hash | top_block_hash (uint64_t *block_height=NULL) const |
| fetch the top block's hash More... | |
| virtual block | get_top_block () const |
| fetch the top block More... | |
| virtual uint64_t | height () const |
| fetch the current blockchain height More... | |
| virtual bool | tx_exists (const crypto::hash &h) const |
| check if a transaction with a given hash exists More... | |
| virtual bool | tx_exists (const crypto::hash &h, uint64_t &tx_index) const |
| virtual uint64_t | get_tx_unlock_time (const crypto::hash &h) const |
| fetch a transaction's unlock time/height More... | |
| virtual bool | get_tx_blob (const crypto::hash &h, cryptonote::blobdata &tx) const |
| fetches the transaction blob with the given hash More... | |
| virtual bool | get_pruned_tx_blob (const crypto::hash &h, cryptonote::blobdata &tx) const |
| fetches the pruned transaction blob with the given hash More... | |
| virtual bool | get_prunable_tx_blob (const crypto::hash &h, cryptonote::blobdata &tx) const |
| fetches the prunable transaction blob with the given hash More... | |
| virtual bool | get_prunable_tx_hash (const crypto::hash &tx_hash, crypto::hash &prunable_hash) const |
| fetches the prunable transaction hash More... | |
| virtual uint64_t | get_tx_count () const |
| fetches the total number of transactions ever More... | |
| virtual std::vector< transaction > | get_tx_list (const std::vector< crypto::hash > &hlist) const |
| fetches a list of transactions based on their hashes More... | |
| virtual uint64_t | get_tx_block_height (const crypto::hash &h) const |
| fetches the height of a transaction's block More... | |
| virtual uint64_t | get_num_outputs (const uint64_t &amount) const |
| fetches the number of outputs of a given amount More... | |
| virtual output_data_t | get_output_key (const uint64_t &amount, const uint64_t &index, bool include_commitmemt) const |
| get some of an output's data More... | |
| 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 |
| gets outputs' data More... | |
| virtual tx_out_index | get_output_tx_and_index_from_global (const uint64_t &index) const |
| gets an output's tx hash and index More... | |
| virtual void | get_output_tx_and_index_from_global (const std::vector< uint64_t > &global_indices, std::vector< tx_out_index > &tx_out_indices) const |
| virtual tx_out_index | get_output_tx_and_index (const uint64_t &amount, const uint64_t &index) const |
| gets an output's tx hash and index More... | |
| virtual void | get_output_tx_and_index (const uint64_t &amount, const std::vector< uint64_t > &offsets, std::vector< tx_out_index > &indices) const |
| gets some outputs' tx hashes and indices More... | |
| virtual std::vector< std::vector< uint64_t > > | get_tx_amount_output_indices (const uint64_t tx_id, size_t n_txes) const |
| gets output indices (amount-specific) for a transaction's outputs More... | |
| virtual bool | has_key_image (const crypto::key_image &img) const |
| check if a key image is stored as spent More... | |
| virtual void | add_txpool_tx (const crypto::hash &txid, const cryptonote::blobdata &blob, const txpool_tx_meta_t &meta) |
| add a txpool transaction More... | |
| virtual void | update_txpool_tx (const crypto::hash &txid, const txpool_tx_meta_t &meta) |
| update a txpool transaction's metadata More... | |
| virtual uint64_t | get_txpool_tx_count (bool include_unrelayed_txes=true) const |
| get the number of transactions in the txpool More... | |
| virtual bool | txpool_has_tx (const crypto::hash &txid) const |
| check whether a txid is in the txpool More... | |
| virtual void | remove_txpool_tx (const crypto::hash &txid) |
| remove a txpool transaction More... | |
| virtual bool | get_txpool_tx_meta (const crypto::hash &txid, txpool_tx_meta_t &meta) const |
| get a txpool transaction's metadata More... | |
| virtual bool | get_txpool_tx_blob (const crypto::hash &txid, cryptonote::blobdata &bd) const |
| get a txpool transaction's blob More... | |
| virtual cryptonote::blobdata | get_txpool_tx_blob (const crypto::hash &txid) const |
| get a txpool transaction's blob More... | |
| virtual uint32_t | get_blockchain_pruning_seed () const |
| get the blockchain pruning seed More... | |
| virtual bool | prune_blockchain (uint32_t pruning_seed=0) |
| prunes the blockchain More... | |
| virtual bool | update_pruning () |
| prunes recent blockchain changes as needed, iff pruning is enabled More... | |
| virtual bool | check_pruning () |
| checks pruning was done correctly, iff enabled More... | |
| virtual bool | for_all_txpool_txes (std::function< bool(const crypto::hash &, const txpool_tx_meta_t &, const cryptonote::blobdata *)> f, bool include_blob=false, bool include_unrelayed_txes=true) const |
| runs a function over all txpool transactions More... | |
| virtual bool | for_all_key_images (std::function< bool(const crypto::key_image &)>) const |
| runs a function over all key images stored More... | |
| 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 |
| runs a function over a range of blocks More... | |
| virtual bool | for_all_transactions (std::function< bool(const crypto::hash &, const cryptonote::transaction &)>, bool pruned) const |
| runs a function over all transactions stored More... | |
| 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 |
| runs a function over all outputs stored More... | |
| virtual bool | for_all_outputs (uint64_t amount, const std::function< bool(uint64_t height)> &f) const |
| 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 More... | |
| virtual void | set_batch_transactions (bool batch_transactions) |
| sets whether or not to batch transactions More... | |
| virtual bool | batch_start (uint64_t batch_num_blocks=0, uint64_t batch_bytes=0) |
| tells the BlockchainDB to start a new "batch" of blocks More... | |
| virtual void | batch_commit () |
| virtual void | batch_stop () |
| ends a batch transaction More... | |
| virtual void | batch_abort () |
| aborts a batch transaction More... | |
| virtual void | block_wtxn_start () |
| virtual void | block_wtxn_stop () |
| virtual void | block_wtxn_abort () |
| virtual bool | block_rtxn_start () const |
| virtual void | block_rtxn_stop () const |
| virtual void | block_rtxn_abort () const |
| bool | block_rtxn_start (MDB_txn **mtxn, mdb_txn_cursors **mcur) const |
| virtual void | pop_block (block &blk, std::vector< transaction > &txs) |
| pops the top block off the blockchain More... | |
| virtual bool | can_thread_bulk_indices () const |
| 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 |
| return a histogram of outputs on the blockchain More... | |
| bool | get_output_distribution (uint64_t amount, uint64_t from_height, uint64_t to_height, std::vector< uint64_t > &distribution, uint64_t &base) const |
| virtual std::vector< address_outputs > | get_addr_output_all (const crypto::public_key &combined_key) |
| virtual std::vector< address_outputs > | get_addr_output_batch (const crypto::public_key &combined_key, uint64_t start_db_index=0, uint64_t batch_size=100, bool desc=false) |
| virtual std::vector< address_txs > | get_addr_tx_all (const crypto::public_key &combined_key) |
| virtual std::vector< address_txs > | get_addr_tx_batch (const crypto::public_key &combined_key, uint64_t start_db_index=0, uint64_t batch_size=100, bool desc=false) |
| virtual uint64_t | get_balance (const crypto::public_key &combined_key) |
| virtual tx_input_t | get_tx_input (const crypto::hash tx_hash, const uint32_t relative_out_index) |
Public Member Functions inherited from cryptonote::BlockchainDB | |
| BlockchainDB () | |
| An empty constructor. More... | |
| virtual | ~BlockchainDB () |
| An empty destructor. More... | |
| void | reset_stats () |
| reset profiling stats More... | |
| void | show_stats () |
| show profiling stats More... | |
| bool | is_open () const |
| Gets the current open/ready state of the BlockchainDB. More... | |
| virtual void | set_hard_fork (HardFork *hf) |
| virtual block | get_block (const crypto::hash &h) const |
| fetches the block with the given hash More... | |
| virtual block | get_block_from_height (const uint64_t &height) const |
| fetch a block by height More... | |
| virtual transaction | get_tx (const crypto::hash &h) const |
| fetches the transaction with the given hash More... | |
| virtual transaction | get_pruned_tx (const crypto::hash &h) const |
| fetches the transaction base with the given hash More... | |
| virtual bool | get_tx (const crypto::hash &h, transaction &tx) const |
| fetches the transaction with the given hash More... | |
| virtual bool | get_pruned_tx (const crypto::hash &h, transaction &tx) const |
| fetches the transaction base with the given hash More... | |
| virtual uint64_t | get_indexing_base () const |
| return index of the first element (should be hidden, but isn't) More... | |
| void | set_auto_remove_logs (bool auto_remove) |
| set whether or not to automatically remove logs More... | |
Static Public Member Functions | |
| static int | compare_uint64 (const MDB_val *a, const MDB_val *b) |
| static int | compare_hash32 (const MDB_val *a, const MDB_val *b) |
| static int | compare_string (const MDB_val *a, const MDB_val *b) |
| static int | compare_data (const MDB_val *a, const MDB_val *b) |
| static int | compare_publickey (const MDB_val *a, const MDB_val *b) |
Static Public Member Functions inherited from cryptonote::BlockchainDB | |
| static void | init_options (boost::program_options::options_description &desc) |
| init command line options More... | |
Additional Inherited Members | |
Public Attributes inherited from cryptonote::BlockchainDB | |
| bool | m_open |
| Whether or not the BlockchainDB is open/ready for use. More... | |
| epee::critical_section | m_synchronization_lock |
| A lock, currently for when BlockchainLMDB needs to resize the backing db file. More... | |
Protected Member Functions inherited from cryptonote::BlockchainDB | |
| 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 More... | |
Protected Attributes inherited from cryptonote::BlockchainDB | |
| uint64_t | time_tx_exists = 0 |
| a performance metric More... | |
| uint64_t | time_commit1 = 0 |
| a performance metric More... | |
| bool | m_auto_remove_logs = true |
| whether or not to automatically remove old logs More... | |
| HardFork * | m_hardfork |
Definition at line 1338 of file db_lmdb.cpp.
| cryptonote::BlockchainLMDB::~BlockchainLMDB | ( | ) |
Definition at line 1324 of file db_lmdb.cpp.
|
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
| blk | the block to be added |
| block_weight | the size of the block (transactions and all) |
| long_term_block_weight | the long term weight of the block (transactions and all) |
| cumulative_difficulty | the accumulated difficulty after this block |
| coins_generated | the number of coins generated total after this block |
| txs | the transactions in the block |
Reimplemented from cryptonote::BlockchainDB.
Definition at line 4484 of file db_lmdb.cpp.

|
virtual |
add a txpool transaction
| details | the details of the transaction to add |
Implements cryptonote::BlockchainDB.
Definition at line 2415 of file db_lmdb.cpp.

|
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
Implements cryptonote::BlockchainDB.
Definition at line 4320 of file db_lmdb.cpp.


|
virtual |
Definition at line 4254 of file db_lmdb.cpp.

|
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
| batch_num_blocks | number of blocks to batch together |
Implements cryptonote::BlockchainDB.
Definition at line 4211 of file db_lmdb.cpp.

|
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
Implements cryptonote::BlockchainDB.
Definition at line 4291 of file db_lmdb.cpp.

|
virtual |
checks if a block exists
| h | the hash of the requested block |
| height | if non NULL, returns the block's height if found |
Implements cryptonote::BlockchainDB.
Definition at line 2993 of file db_lmdb.cpp.

|
virtual |
Implements cryptonote::BlockchainDB.
Definition at line 4477 of file db_lmdb.cpp.

|
virtual |
Implements cryptonote::BlockchainDB.
Definition at line 4399 of file db_lmdb.cpp.
| bool cryptonote::BlockchainLMDB::block_rtxn_start | ( | MDB_txn ** | mtxn, |
| mdb_txn_cursors ** | mcur | ||
| ) | const |
Definition at line 4355 of file db_lmdb.cpp.

|
virtual |
Implements cryptonote::BlockchainDB.
Definition at line 4392 of file db_lmdb.cpp.

|
virtual |
Implements cryptonote::BlockchainDB.
Definition at line 4461 of file db_lmdb.cpp.

|
virtual |
Implements cryptonote::BlockchainDB.
Definition at line 4406 of file db_lmdb.cpp.


|
virtual |
Implements cryptonote::BlockchainDB.
Definition at line 4439 of file db_lmdb.cpp.


|
inlinevirtual |
|
virtual |
checks pruning was done correctly, iff enabled
Implements cryptonote::BlockchainDB.
Definition at line 2936 of file db_lmdb.cpp.
|
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
Implements cryptonote::BlockchainDB.
Definition at line 1624 of file db_lmdb.cpp.

Definition at line 172 of file db_lmdb.cpp.
Definition at line 151 of file db_lmdb.cpp.
Definition at line 188 of file db_lmdb.cpp.
Definition at line 165 of file db_lmdb.cpp.
|
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.
| std::function | fn the function to run |
Implements cryptonote::BlockchainDB.
Definition at line 3989 of file db_lmdb.cpp.
|
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.
| std::function | f the function to run |
Implements cryptonote::BlockchainDB.
Definition at line 4135 of file db_lmdb.cpp.

|
virtual |
Implements cryptonote::BlockchainDB.
Definition at line 4170 of file db_lmdb.cpp.

|
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.
| std::function | fn the function to run |
| bool | pruned whether to only get pruned tx data, or the whole |
Implements cryptonote::BlockchainDB.
Definition at line 4073 of file db_lmdb.cpp.

|
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.
| std::function | fn the function to run |
Implements cryptonote::BlockchainDB.
Definition at line 2941 of file db_lmdb.cpp.

|
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.
| h1 | the start height |
| h2 | the end height |
| std::function | fn the function to run |
Implements cryptonote::BlockchainDB.
Definition at line 4022 of file db_lmdb.cpp.

|
virtual |
Implements cryptonote::BlockchainDB.
Definition at line 2071 of file db_lmdb.cpp.

|
virtual |
Implements cryptonote::BlockchainDB.
Definition at line 2112 of file db_lmdb.cpp.

|
virtual |
Implements cryptonote::BlockchainDB.
Definition at line 2214 of file db_lmdb.cpp.

|
virtual |
Implements cryptonote::BlockchainDB.
Definition at line 2249 of file db_lmdb.cpp.

|
virtual |
Implements cryptonote::BlockchainDB.
Definition at line 2298 of file db_lmdb.cpp.

|
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
| height | the height requested |
Implements cryptonote::BlockchainDB.
Definition at line 3405 of file db_lmdb.cpp.

|
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
| h | the hash to look for |
Implements cryptonote::BlockchainDB.
Definition at line 3024 of file db_lmdb.cpp.

|
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
| height | the height to look for |
Implements cryptonote::BlockchainDB.
Definition at line 3062 of file db_lmdb.cpp.


|
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
| height | the height requested |
Implements cryptonote::BlockchainDB.
Definition at line 3363 of file db_lmdb.cpp.


|
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
| height | the height requested |
Implements cryptonote::BlockchainDB.
Definition at line 3111 of file db_lmdb.cpp.

|
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
| height | the height requested |
Implements cryptonote::BlockchainDB.
Definition at line 3388 of file db_lmdb.cpp.

|
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
| height | the height requested |
Implements cryptonote::BlockchainDB.
Definition at line 3451 of file db_lmdb.cpp.


|
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
| h | the hash to look for |
Implements cryptonote::BlockchainDB.
Definition at line 3053 of file db_lmdb.cpp.

|
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
| h | the hash to look for |
Implements cryptonote::BlockchainDB.
Definition at line 3032 of file db_lmdb.cpp.


|
virtual |
fetch a block's long term weight
If the block does not exist, the subclass should throw BLOCK_DNE
| height | the height requested |
Implements cryptonote::BlockchainDB.
Definition at line 3428 of file db_lmdb.cpp.

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
| height | the height requested |
Implements cryptonote::BlockchainDB.
Definition at line 3088 of file db_lmdb.cpp.


|
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
| height | the height requested |
Implements cryptonote::BlockchainDB.
Definition at line 3188 of file db_lmdb.cpp.

|
virtual |
fetch the last N blocks' weights
If there are fewer than N blocks, the returned array will be smaller than N
| count | the number of blocks requested |
Implements cryptonote::BlockchainDB.
Definition at line 3317 of file db_lmdb.cpp.

|
virtual |
get the blockchain pruning seed
Implements cryptonote::BlockchainDB.
Definition at line 2608 of file db_lmdb.cpp.

|
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)
| h1 | the start height |
| h2 | the end height |
Implements cryptonote::BlockchainDB.
Definition at line 3474 of file db_lmdb.cpp.

|
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.
Implements cryptonote::BlockchainDB.
Definition at line 1755 of file db_lmdb.cpp.
|
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.
Implements cryptonote::BlockchainDB.
Definition at line 1724 of file db_lmdb.cpp.
|
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)
| h1 | the start height |
| h2 | the end height |
Implements cryptonote::BlockchainDB.
Definition at line 3488 of file db_lmdb.cpp.

|
virtual |
fetch the last N blocks' long term weights
If there are fewer than N blocks, the returned array will be smaller than N
| count | the number of blocks requested |
Implements cryptonote::BlockchainDB.
Definition at line 3322 of file db_lmdb.cpp.

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.
| amount | the output amount being looked up |
Implements cryptonote::BlockchainDB.
Definition at line 3835 of file db_lmdb.cpp.


|
virtual |
Implements cryptonote::BlockchainDB.
Definition at line 4744 of file db_lmdb.cpp.

|
virtual |
return a histogram of outputs on the blockchain
| amounts | optional set of amounts to lookup |
| unlocked | whether to restrict count to unlocked outputs |
| recent_cutoff | timestamp to determine which outputs are recent |
| min_count | return only amounts with at least that many instances |
Implements cryptonote::BlockchainDB.
Definition at line 4651 of file db_lmdb.cpp.

|
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.
| amount | the output amount |
| index | the output's index (indexed by amount) |
Implements cryptonote::BlockchainDB.
Definition at line 3859 of file db_lmdb.cpp.

|
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.
| amounts | an output amount, or as many as offsets |
| offsets | a list of amount-specific output indices |
| outputs | return-by-reference a list of outputs' metadata |
Implements cryptonote::BlockchainDB.
Definition at line 4560 of file db_lmdb.cpp.

|
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.
| amount | an output amount |
| index | an output's amount-specific index |
Implements cryptonote::BlockchainDB.
Definition at line 3916 of file db_lmdb.cpp.

|
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.
| amount | an output amount |
| offsets | a list of amount-specific output indices |
| indices | return-by-reference a list of tx hashes and output indices (as pairs) |
Implements cryptonote::BlockchainDB.
Definition at line 4615 of file db_lmdb.cpp.

|
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.
| index | an output's global index |
Implements cryptonote::BlockchainDB.
Definition at line 3893 of file db_lmdb.cpp.


|
virtual |
Definition at line 4532 of file db_lmdb.cpp.

|
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.
| h | the hash to look for |
Implements cryptonote::BlockchainDB.
Definition at line 3721 of file db_lmdb.cpp.

|
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.
| h | the tx hash to look for |
Implements cryptonote::BlockchainDB.
Definition at line 3751 of file db_lmdb.cpp.

|
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.
| h | the hash to look for |
Implements cryptonote::BlockchainDB.
Definition at line 3691 of file db_lmdb.cpp.

|
virtual |
fetch the top block
The subclass should return most recent block
Implements cryptonote::BlockchainDB.
Definition at line 3517 of file db_lmdb.cpp.

|
virtual |
fetch the top block's timestamp
The subclass should return the timestamp of the most recent block.
Implements cryptonote::BlockchainDB.
Definition at line 3173 of file db_lmdb.cpp.

|
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.
| tx_id | a transaction ID |
| n_txes | how many txes to get data for, starting with tx_id |
Implements cryptonote::BlockchainDB.
Definition at line 3929 of file db_lmdb.cpp.

|
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.
| h | the hash to look for |
Implements cryptonote::BlockchainDB.
Definition at line 3655 of file db_lmdb.cpp.

|
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.
| h | the hash of the transaction |
Implements cryptonote::BlockchainDB.
Definition at line 3812 of file db_lmdb.cpp.


|
virtual |
fetches the total number of transactions ever
The subclass should return a count of all the transactions from all blocks.
Implements cryptonote::BlockchainDB.
Definition at line 3781 of file db_lmdb.cpp.

|
virtual |
Implements cryptonote::BlockchainDB.
Definition at line 1973 of file db_lmdb.cpp.

|
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.
| hlist | a list of hashes |
Implements cryptonote::BlockchainDB.
Definition at line 3798 of file db_lmdb.cpp.

|
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.
| h | the hash of the requested transaction |
Implements cryptonote::BlockchainDB.
Definition at line 3634 of file db_lmdb.cpp.

|
virtual |
get a txpool transaction's blob
| txid | the transaction id of the transation to lookup |
| bd | the blob to return |
Implements cryptonote::BlockchainDB.
Definition at line 2579 of file db_lmdb.cpp.


|
virtual |
get a txpool transaction's blob
| txid | the transaction id of the transation to lookup |
Implements cryptonote::BlockchainDB.
Definition at line 2600 of file db_lmdb.cpp.

|
virtual |
get the number of transactions in the txpool
Implements cryptonote::BlockchainDB.
Definition at line 2467 of file db_lmdb.cpp.

|
virtual |
get a txpool transaction's metadata
| txid | the transaction id of the transation to lookup |
| meta | the metadata to return |
Implements cryptonote::BlockchainDB.
Definition at line 2558 of file db_lmdb.cpp.

|
virtual |
check if a key image is stored as spent
| img | the key image to check for |
Implements cryptonote::BlockchainDB.
Definition at line 3972 of file db_lmdb.cpp.

|
virtual |
fetch the current blockchain height
The subclass should return the current blockchain height
Implements cryptonote::BlockchainDB.
Definition at line 3532 of file db_lmdb.cpp.


|
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
Implements cryptonote::BlockchainDB.
Definition at line 1763 of file db_lmdb.cpp.
|
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
| filename | a string referring to the BlockchainDB to open |
| db_flags | flags relevant to how to open/use the BlockchainDB |
Implements cryptonote::BlockchainDB.
Definition at line 1357 of file db_lmdb.cpp.
|
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
| blk | return-by-reference the block which was popped |
| txs | return-by-reference the transactions from the popped block |
Reimplemented from cryptonote::BlockchainDB.
Definition at line 4513 of file db_lmdb.cpp.

prunes the blockchain
| pruning_seed | the seed to use, 0 for default (highly recommended) |
Implements cryptonote::BlockchainDB.
Definition at line 2926 of file db_lmdb.cpp.
|
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().
| folder | The path of the folder containing the database file(s) which must not end with slash '/'. |
Implements cryptonote::BlockchainDB.
Definition at line 1740 of file db_lmdb.cpp.
|
virtual |
remove a txpool transaction
| txid | the transaction id of the transation to remove |
Implements cryptonote::BlockchainDB.
Definition at line 2528 of file db_lmdb.cpp.

|
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
Implements cryptonote::BlockchainDB.
Definition at line 1662 of file db_lmdb.cpp.

|
virtual |
toggle safe syncs for the DB
Used to switch DBF_SAFE on or off after starting up with DBF_FAST.
Implements cryptonote::BlockchainDB.
Definition at line 1656 of file db_lmdb.cpp.

|
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
| bool | batch whether or not to use batch transactions. |
Implements cryptonote::BlockchainDB.
Definition at line 4343 of file db_lmdb.cpp.
|
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
| height | the height requested |
| diff | the cumulative difficulty value to be set |
Implements cryptonote::BlockchainDB.
Definition at line 3327 of file db_lmdb.cpp.

|
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
Implements cryptonote::BlockchainDB.
Definition at line 1640 of file db_lmdb.cpp.


|
virtual |
fetch the top block's hash
The subclass should return the hash of the most recent block
| block_height | if non NULL, returns the height of that block (ie, the blockchain height minus 1) |
Implements cryptonote::BlockchainDB.
Definition at line 3502 of file db_lmdb.cpp.

|
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.
| h | the hash to check against |
| tx_id | (optional) returns the tx_id for the tx hash |
Implements cryptonote::BlockchainDB.
Definition at line 3568 of file db_lmdb.cpp.

|
virtual |
Implements cryptonote::BlockchainDB.
Definition at line 3600 of file db_lmdb.cpp.

|
virtual |
check whether a txid is in the txpool
Implements cryptonote::BlockchainDB.
Definition at line 2512 of file db_lmdb.cpp.

|
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
Implements cryptonote::BlockchainDB.
Definition at line 1771 of file db_lmdb.cpp.
|
virtual |
prunes recent blockchain changes as needed, iff pruning is enabled
Implements cryptonote::BlockchainDB.
Definition at line 2931 of file db_lmdb.cpp.
|
virtual |
update a txpool transaction's metadata
| txid | the txid of the transaction to update |
| details | the details of the transaction to update |
Implements cryptonote::BlockchainDB.
Definition at line 2441 of file db_lmdb.cpp.
