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/lmdb/db_lmdb.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 'src/blockchain_db/lmdb/db_lmdb.h')
-rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.h b/src/blockchain_db/lmdb/db_lmdb.h index f1773bac8..cc1b06ca0 100644 --- a/src/blockchain_db/lmdb/db_lmdb.h +++ b/src/blockchain_db/lmdb/db_lmdb.h @@ -50,6 +50,9 @@ typedef struct mdb_txn_cursors MDB_cursor *m_txc_output_amounts; MDB_cursor *m_txc_txs; + MDB_cursor *m_txc_txs_pruned; + MDB_cursor *m_txc_txs_prunable; + MDB_cursor *m_txc_txs_prunable_hash; MDB_cursor *m_txc_tx_indices; MDB_cursor *m_txc_tx_outputs; @@ -67,6 +70,9 @@ typedef struct mdb_txn_cursors #define m_cur_output_txs m_cursors->m_txc_output_txs #define m_cur_output_amounts m_cursors->m_txc_output_amounts #define m_cur_txs m_cursors->m_txc_txs +#define m_cur_txs_pruned m_cursors->m_txc_txs_pruned +#define m_cur_txs_prunable m_cursors->m_txc_txs_prunable +#define m_cur_txs_prunable_hash m_cursors->m_txc_txs_prunable_hash #define m_cur_tx_indices m_cursors->m_txc_tx_indices #define m_cur_tx_outputs m_cursors->m_txc_tx_outputs #define m_cur_spent_keys m_cursors->m_txc_spent_keys @@ -83,6 +89,9 @@ typedef struct mdb_rflags bool m_rf_output_txs; bool m_rf_output_amounts; bool m_rf_txs; + bool m_rf_txs_pruned; + bool m_rf_txs_prunable; + bool m_rf_txs_prunable_hash; bool m_rf_tx_indices; bool m_rf_tx_outputs; bool m_rf_spent_keys; @@ -218,6 +227,8 @@ public: virtual uint64_t get_tx_unlock_time(const crypto::hash& h) const; virtual bool get_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const; + virtual bool get_pruned_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const; + virtual bool get_prunable_tx_hash(const crypto::hash& tx_hash, crypto::hash &prunable_hash) const; virtual uint64_t get_tx_count() const; @@ -254,7 +265,7 @@ public: virtual bool for_all_key_images(std::function<bool(const crypto::key_image&)>) const; 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; - virtual bool for_all_transactions(std::function<bool(const crypto::hash&, const cryptonote::transaction&)>) const; + virtual bool for_all_transactions(std::function<bool(const crypto::hash&, const cryptonote::transaction&)>, bool pruned) const; 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; virtual bool for_all_outputs(uint64_t amount, const std::function<bool(uint64_t height)> &f) const; @@ -311,7 +322,7 @@ private: virtual void remove_block(); - virtual uint64_t add_transaction_data(const crypto::hash& blk_hash, const transaction& tx, const crypto::hash& tx_hash); + 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); virtual void remove_transaction_data(const crypto::hash& tx_hash, const transaction& tx); @@ -373,6 +384,9 @@ private: // migrate from DB version 0 to 1 void migrate_0_1(); + // migrate from DB version 1 to 2 + void migrate_1_2(); + void cleanup_batch(); private: @@ -383,6 +397,9 @@ private: MDB_dbi m_block_info; MDB_dbi m_txs; + MDB_dbi m_txs_pruned; + MDB_dbi m_txs_prunable; + MDB_dbi m_txs_prunable_hash; MDB_dbi m_tx_indices; MDB_dbi m_tx_outputs; |