diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-06-29 19:55:49 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-08-28 21:29:02 +0100 |
commit | 59a66e209a844ac6d4221f7c04141b32fa2823c3 (patch) | |
tree | a7307663fea9cccad2a0c0bcd5c26469524c9e98 /src/blockchain_db/blockchain_db.h | |
parent | rct: add the tx prefix hash into the MLSAG (diff) | |
download | monero-59a66e209a844ac6d4221f7c04141b32fa2823c3.tar.xz |
move the rct commitments to the output_amounts database
Since these are needed at the same time as the output pubkeys,
this is a whole lot faster, and takes less space. Only outputs
of 0 amount store the commitment. When reading other outputs,
a fake commitment is regenerated on the fly. This avoids having
to rewrite the database to add space for fake commitments for
existing outputs.
This code relies on two things:
- LMDB must support fixed size records per key, rather than
per database (ie, all records on key 0 are the same size, all
records for non 0 keys are same size, but records from key 0
and non 0 keys do have different sizes).
- the commitment must be directly after the rest of the data
in outkey and output_data_t.
Diffstat (limited to 'src/blockchain_db/blockchain_db.h')
-rw-r--r-- | src/blockchain_db/blockchain_db.h | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/src/blockchain_db/blockchain_db.h b/src/blockchain_db/blockchain_db.h index 5b759db4c..d26080a3b 100644 --- a/src/blockchain_db/blockchain_db.h +++ b/src/blockchain_db/blockchain_db.h @@ -110,6 +110,7 @@ struct output_data_t crypto::public_key pubkey; //!< the output's public key (for spend verification) uint64_t unlock_time; //!< the output's unlock time (or height) uint64_t height; //!< the height of the block which created the output + rct::key commitment; //!< the output's amount commitment (for spend verification) }; #pragma pack(pop) @@ -407,9 +408,10 @@ private: * @param tx_output the output * @param local_index index of the output in its transaction * @param unlock_time unlock time/height of the output + * @param commitment the rct commitment to the output amount * @return amount output index */ - virtual uint64_t add_output(const crypto::hash& tx_hash, const tx_out& tx_output, const uint64_t& local_index, const uint64_t unlock_time) = 0; + virtual uint64_t add_output(const crypto::hash& tx_hash, const tx_out& tx_output, const uint64_t& local_index, const uint64_t unlock_time, const rct::key *commitment) = 0; /** * @brief store amount output indices for a tx's outputs @@ -1200,39 +1202,6 @@ public: virtual bool has_key_image(const crypto::key_image& img) const = 0; /** - * @brief returns the number of ringct outputs in the database - * - * @return the number of ringct outputs in the database - */ - virtual uint64_t get_num_rct_outputs() const = 0; - - /** - * @brief returns the commitment for a given ringct output - * - * Throws OUTPUT_DNE if the index is out of range - * Throws DB_ERROR on other error - * - * @return the commitment for the given index - */ - virtual rct::key get_rct_commitment(uint64_t idx) const = 0; - - /** - * @brief Adds a new ringct output with the given commitment - * - * Throws DB_ERROR if the addition fails - * - * @return the index of the newly added record - */ - virtual uint64_t add_rct_commitment(const rct::key &commitment) = 0; - - /** - * @brief Remove a ringct output with the given index - * - * Throws DB_ERROR if the removal fails - */ - virtual void remove_rct_commitment(uint64_t idx) = 0; - - /** * @brief runs a function over all key images stored * * The subclass should run the passed function for each key image it has |