|
Electroneum
|
#include <string>#include <exception>#include <boost/program_options.hpp>#include "common/command_line.h"#include "crypto/hash.h"#include "cryptonote_basic/blobdatatype.h"#include "cryptonote_basic/cryptonote_basic.h"#include "cryptonote_basic/difficulty.h"#include "cryptonote_basic/hardfork.h"

Go to the source code of this file.
Classes | |
| struct | cryptonote::output_data_t |
| a struct containing output metadata More... | |
| struct | cryptonote::tx_data_t |
| struct | cryptonote::txpool_tx_meta_t |
| a struct containing txpool per transaction metadata More... | |
| class | cryptonote::DB_EXCEPTION |
| A base class for BlockchainDB exceptions. More... | |
| class | cryptonote::DB_ERROR |
| A generic BlockchainDB exception. More... | |
| class | cryptonote::DB_ERROR_TXN_START |
| thrown when there is an error starting a DB transaction More... | |
| class | cryptonote::DB_OPEN_FAILURE |
| thrown when opening the BlockchainDB fails More... | |
| class | cryptonote::DB_CREATE_FAILURE |
| thrown when creating the BlockchainDB fails More... | |
| class | cryptonote::DB_SYNC_FAILURE |
| thrown when synchronizing the BlockchainDB to disk fails More... | |
| class | cryptonote::BLOCK_DNE |
| thrown when a requested block does not exist More... | |
| class | cryptonote::BLOCK_PARENT_DNE |
| thrown when a block's parent does not exist (and it needed to) More... | |
| class | cryptonote::BLOCK_EXISTS |
| thrown when a block exists, but shouldn't, namely when adding a block More... | |
| class | cryptonote::BLOCK_INVALID |
| thrown when something is wrong with the block to be added More... | |
| class | cryptonote::TX_DNE |
| thrown when a requested transaction does not exist More... | |
| class | cryptonote::TX_EXISTS |
| thrown when a transaction exists, but shouldn't, namely when adding a block More... | |
| class | cryptonote::OUTPUT_DNE |
| thrown when a requested output does not exist More... | |
| class | cryptonote::OUTPUT_EXISTS |
| thrown when an output exists, but shouldn't, namely when adding a block More... | |
| class | cryptonote::KEY_IMAGE_EXISTS |
| thrown when a spent key image exists, but shouldn't, namely when adding a block More... | |
| class | cryptonote::BlockchainDB |
| The BlockchainDB backing store interface declaration/contract. More... | |
| class | cryptonote::db_txn_guard |
| class | cryptonote::db_rtxn_guard |
| class | cryptonote::db_wtxn_guard |
Namespaces | |
| cryptonote | |
| Holds cryptonote related classes and helpers. | |
Macros | |
| #define | DBF_SAFE 1 |
| #define | DBF_FAST 2 |
| #define | DBF_FASTEST 4 |
| #define | DBF_RDONLY 8 |
| #define | DBF_SALVAGE 0x10 |
Typedefs | |
| typedef std::pair< crypto::hash, uint64_t > | cryptonote::tx_out_index |
Functions | |
| BlockchainDB * | cryptonote::new_db (const std::string &db_type) |
Cryptonote Blockchain Database Interface
The DB interface is a store for the canonical block chain. It serves as a persistent storage for the blockchain.
For the sake of efficiency, a concrete implementation may also store some blockchain data outside of the blocks, such as spent transfer key images, unspent transaction outputs, etc.
Examples are as follows:
Transactions are duplicated so that we don't have to fetch a whole block in order to fetch a transaction from that block.
Spent key images are duplicated outside of the blocks so it is quick to verify an output hasn't already been spent
Unspent transaction outputs are duplicated to quickly gather random outputs to use for mixins
Indices and Identifiers: The word "index" is used ambiguously throughout this code. It is particularly confusing when talking about the output or transaction tables since their indexing can refer to themselves or each other. I have attempted to clarify these usages here:
Blocks, transactions, and outputs are all identified by a hash. For storage efficiency, a 64-bit integer ID is used instead of the hash inside the DB. Tables exist to map between hash and ID. A block ID is also referred to as its "height". Transactions and outputs generally are not referred to by ID outside of this module, but the tx ID is returned by tx_exists() and used by get_tx_amount_output_indices(). Like their corresponding hashes, IDs are globally unique.
The remaining uses of the word "index" refer to local offsets, and are not globally unique. An "amount output index" N refers to the Nth output of a specific amount. An "output local index" N refers to the Nth output of a specific tx.
Exceptions: DB_ERROR – generic DB_OPEN_FAILURE DB_CREATE_FAILURE DB_SYNC_FAILURE BLOCK_DNE BLOCK_PARENT_DNE BLOCK_EXISTS BLOCK_INVALID – considering making this multiple errors TX_DNE TX_EXISTS OUTPUT_DNE OUTPUT_EXISTS KEY_IMAGE_EXISTS
| #define DBF_FAST 2 |
| #define DBF_FASTEST 4 |
| #define DBF_RDONLY 8 |
| #define DBF_SAFE 1 |
| #define DBF_SALVAGE 0x10 |