diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-10-01 11:24:33 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-05-23 22:48:12 +0100 |
commit | b9389e582eb4e1806ce25a14fa492259c3d40dfc (patch) | |
tree | 0b1a1f43f8d781b6f4ea13cd2694b491eb7ee81d /src/blockchain_db/blockchain_db.h | |
parent | Merge pull request #3787 (diff) | |
download | monero-b9389e582eb4e1806ce25a14fa492259c3d40dfc.tar.xz |
db_lmdb: save pruned and prunable tx data separately
This bumps DB version to 2, migration code will run for v1 DBs
Diffstat (limited to '')
-rw-r--r-- | src/blockchain_db/blockchain_db.h | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/src/blockchain_db/blockchain_db.h b/src/blockchain_db/blockchain_db.h index 1ed715315..19ba32340 100644 --- a/src/blockchain_db/blockchain_db.h +++ b/src/blockchain_db/blockchain_db.h @@ -398,9 +398,10 @@ private: * @param blk_hash the hash of the block containing the transaction * @param tx the transaction to be added * @param tx_hash the hash of the transaction + * @param tx_prunable_hash the hash of the prunable part of the transaction * @return the transaction ID */ - virtual uint64_t add_transaction_data(const crypto::hash& blk_hash, const transaction& tx, const crypto::hash& tx_hash) = 0; + virtual uint64_t add_transaction_data(const crypto::hash& blk_hash, const transaction& tx, const crypto::hash& tx_hash, const crypto::hash& tx_prunable_hash) = 0; /** * @brief remove data about a transaction @@ -526,8 +527,9 @@ protected: * @param blk_hash hash of the block which has the transaction * @param tx the transaction to add * @param tx_hash_ptr the hash of the transaction, if already calculated + * @param tx_prunable_hash_ptr the hash of the prunable part of the transaction, if already calculated */ - void add_transaction(const crypto::hash& blk_hash, const transaction& tx, const crypto::hash* tx_hash_ptr = NULL); + void add_transaction(const crypto::hash& blk_hash, const transaction& tx, const crypto::hash* tx_hash_ptr = NULL, const crypto::hash* tx_prunable_hash_ptr = NULL); mutable uint64_t time_tx_exists = 0; //!< a performance metric uint64_t time_commit1 = 0; //!< a performance metric @@ -1120,6 +1122,33 @@ public: virtual bool get_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const = 0; /** + * @brief 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. + * + * @param h the hash to look for + * + * @return true iff the transaction was found + */ + virtual bool get_pruned_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const = 0; + + /** + * @brief 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. + * + * @param h the tx hash to look for + * + * @return true iff the transaction was found + */ + virtual bool get_prunable_tx_hash(const crypto::hash& tx_hash, crypto::hash &prunable_hash) const = 0; + + /** * @brief fetches the total number of transactions ever * * The subclass should return a count of all the transactions from @@ -1426,10 +1455,11 @@ public: * not found. Current implementations simply return false. * * @param std::function fn the function to run + * @param bool pruned whether to only get pruned tx data, or the whole * * @return false if the function returns false for any transaction, otherwise true */ - virtual bool for_all_transactions(std::function<bool(const crypto::hash&, const cryptonote::transaction&)>) const = 0; + virtual bool for_all_transactions(std::function<bool(const crypto::hash&, const cryptonote::transaction&)>, bool pruned) const = 0; /** * @brief runs a function over all outputs stored |