diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-02-21 11:27:15 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-02-21 11:27:15 +0200 |
commit | 49efd3add9f7b9bbcbd2526538846f6d8e58ac86 (patch) | |
tree | e3f1c97cd7dfb7a1c82927f3c2d483bfbe1afbe2 /src/blockchain_db/blockchain_db.h | |
parent | Merge pull request #1725 (diff) | |
parent | blockchain_db: add "raw" blobdata getters for block and transaction (diff) | |
download | monero-49efd3add9f7b9bbcbd2526538846f6d8e58ac86.tar.xz |
Merge pull request #1727
0288310e blockchain_db: add "raw" blobdata getters for block and transaction (moneromooo-monero)
Diffstat (limited to 'src/blockchain_db/blockchain_db.h')
-rw-r--r-- | src/blockchain_db/blockchain_db.h | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/src/blockchain_db/blockchain_db.h b/src/blockchain_db/blockchain_db.h index b40793241..fc1f98ce0 100644 --- a/src/blockchain_db/blockchain_db.h +++ b/src/blockchain_db/blockchain_db.h @@ -34,6 +34,7 @@ #include <string> #include <exception> #include "crypto/hash.h" +#include "cryptonote_protocol/blobdatatype.h" #include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_basic/difficulty.h" #include "cryptonote_basic/hardfork.h" @@ -754,7 +755,20 @@ public: * * @return the block requested */ - virtual block get_block(const crypto::hash& h) const = 0; + virtual cryptonote::blobdata get_block_blob(const crypto::hash& h) const = 0; + + /** + * @brief fetches the block with the given hash + * + * Returns the requested block. + * + * If the block does not exist, the subclass should throw BLOCK_DNE + * + * @param h the hash to look for + * + * @return the block requested + */ + block get_block(const crypto::hash& h) const; /** * @brief gets the height of the block with a given hash @@ -784,7 +798,7 @@ public: virtual block_header get_block_header(const crypto::hash& h) const = 0; /** - * @brief fetch a block by height + * @brief fetch a block blob by height * * The subclass should return the block at the given height. * @@ -793,9 +807,21 @@ public: * * @param height the height to look for * + * @return the block blob + */ + virtual cryptonote::blobdata get_block_blob_from_height(const uint64_t& height) const = 0; + + /** + * @brief 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 + * + * @param height the height to look for + * * @return the block */ - virtual block get_block_from_height(const uint64_t& height) const = 0; + block get_block_from_height(const uint64_t& height) const; /** * @brief fetch a block's timestamp @@ -1009,20 +1035,28 @@ public: /** * @brief fetches the transaction 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 throw TX_DNE. * * @param h the hash to look for * * @return the transaction with the given hash */ - virtual transaction get_tx(const crypto::hash& h) const = 0; + transaction get_tx(const crypto::hash& h) const; /** * @brief fetches the transaction with the given hash * + * If the transaction does not exist, the subclass should return false. + * + * @param h the hash to look for + * + * @return true iff the transaction was found + */ + bool get_tx(const crypto::hash& h, transaction &tx) const; + + /** + * @brief fetches the transaction blob with the given hash + * * The subclass should return the transaction stored which has the given * hash. * @@ -1032,7 +1066,7 @@ public: * * @return true iff the transaction was found */ - virtual bool get_tx(const crypto::hash& h, transaction &tx) const = 0; + virtual bool get_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const = 0; /** * @brief fetches the total number of transactions ever |