aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db/blockchain_db.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-04-29 23:30:51 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-01-22 20:30:51 +0000
commitb750fb27b0f20e9443827732b69a504a76036430 (patch)
tree36fdd03f84ae78dbd217b5bd255bd86e33db1bcc /src/blockchain_db/blockchain_db.h
parentMerge pull request #5008 (diff)
downloadmonero-b750fb27b0f20e9443827732b69a504a76036430.tar.xz
Pruning
The blockchain prunes seven eighths of prunable tx data. This saves about two thirds of the blockchain size, while keeping the node useful as a sync source for an eighth of the blockchain. No other data is currently pruned. There are three ways to prune a blockchain: - run monerod with --prune-blockchain - run "prune_blockchain" in the monerod console - run the monero-blockchain-prune utility The first two will prune in place. Due to how LMDB works, this will not reduce the blockchain size on disk. Instead, it will mark parts of the file as free, so that future data will use that free space, causing the file to not grow until free space grows scarce. The third way will create a second database, a pruned copy of the original one. Since this is a new file, this one will be smaller than the original one. Once the database is pruned, it will stay pruned as it syncs. That is, there is no need to use --prune-blockchain again, etc.
Diffstat (limited to 'src/blockchain_db/blockchain_db.h')
-rw-r--r--src/blockchain_db/blockchain_db.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/blockchain_db/blockchain_db.h b/src/blockchain_db/blockchain_db.h
index fe61aabd8..137d5958a 100644
--- a/src/blockchain_db/blockchain_db.h
+++ b/src/blockchain_db/blockchain_db.h
@@ -1126,6 +1126,17 @@ public:
virtual transaction get_tx(const crypto::hash& h) const;
/**
+ * @brief fetches the transaction base with 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_pruned_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.
@@ -1137,6 +1148,17 @@ public:
virtual bool get_tx(const crypto::hash& h, transaction &tx) const;
/**
+ * @brief fetches the transaction base 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
+ */
+ virtual bool get_pruned_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
@@ -1165,6 +1187,21 @@ public:
virtual bool get_pruned_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const = 0;
/**
+ * @brief 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.
+ *
+ * @param h the hash to look for
+ *
+ * @return true iff the transaction was found and we have its prunable data
+ */
+ virtual bool get_prunable_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.
@@ -1413,6 +1450,31 @@ public:
virtual void prune_outputs(uint64_t amount) = 0;
/**
+ * @brief get the blockchain pruning seed
+ * @return the blockchain pruning seed
+ */
+ virtual uint32_t get_blockchain_pruning_seed() const = 0;
+
+ /**
+ * @brief prunes the blockchain
+ * @param pruning_seed the seed to use, 0 for default (highly recommended)
+ * @return success iff true
+ */
+ virtual bool prune_blockchain(uint32_t pruning_seed = 0) = 0;
+
+ /**
+ * @brief prunes recent blockchain changes as needed, iff pruning is enabled
+ * @return success iff true
+ */
+ virtual bool update_pruning() = 0;
+
+ /**
+ * @brief checks pruning was done correctly, iff enabled
+ * @return success iff true
+ */
+ virtual bool check_pruning() = 0;
+
+ /**
* @brief runs a function over all txpool transactions
*
* The subclass should run the passed function for each txpool tx it has