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/cryptonote_core | |
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/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 82bc6c0d4..f46de9ca8 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -207,21 +207,8 @@ bool Blockchain::scan_outputkeys_for_indexes(size_t tx_version, const txin_to_ke else output_index = m_db->get_output_key(tx_in_to_key.amount, i); - rct::key commitment; - if (tx_version > 1) - { - if (tx_in_to_key.amount == 0) - commitment = m_db->get_rct_commitment(i); - else - commitment = rct::zeroCommit(tx_in_to_key.amount); - } - else - { - rct::identity(commitment); - } - // call to the passed boost visitor to grab the public key for the output - if (!vis.handle_output(output_index.unlock_time, output_index.pubkey, commitment)) + if (!vis.handle_output(output_index.unlock_time, output_index.pubkey, output_index.commitment)) { LOG_PRINT_L0("Failed to handle_output for output no = " << count << ", with absolute offset " << i); return false; @@ -1633,15 +1620,7 @@ void Blockchain::add_out_to_get_rct_random_outs(std::list<COMMAND_RPC_GET_RANDOM oen.global_amount_index = i; output_data_t data = m_db->get_output_key(amount, i); oen.out_key = data.pubkey; - if (amount == 0) - { - oen.commitment = m_db->get_rct_commitment(i); - } - else - { - // not a rct output, make a fake commitment with zero key - oen.commitment = rct::zeroCommit(amount); - } + oen.commitment = data.commitment; } //------------------------------------------------------------------ // This function takes an RPC request for mixins and creates an RPC response |