mirror of
https://github.com/monero-project/monero.git
synced 2024-11-17 08:17:37 +00:00
blockchain_db: allow getting output keys without commitment
Since the commitment has to be calculated for non rct outputs, it slows down a lot unnecessarily if we don't need it
This commit is contained in:
parent
6285c43ffc
commit
a6216d1ac2
4 changed files with 6 additions and 5 deletions
|
@ -1258,7 +1258,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return the requested output data
|
* @return the requested output data
|
||||||
*/
|
*/
|
||||||
virtual output_data_t get_output_key(const uint64_t& amount, const uint64_t& index) const = 0;
|
virtual output_data_t get_output_key(const uint64_t& amount, const uint64_t& index, bool include_commitmemt = true) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief gets an output's tx hash and index
|
* @brief gets an output's tx hash and index
|
||||||
|
|
|
@ -2536,7 +2536,7 @@ uint64_t BlockchainLMDB::get_num_outputs(const uint64_t& amount) const
|
||||||
return num_elems;
|
return num_elems;
|
||||||
}
|
}
|
||||||
|
|
||||||
output_data_t BlockchainLMDB::get_output_key(const uint64_t& amount, const uint64_t& index) const
|
output_data_t BlockchainLMDB::get_output_key(const uint64_t& amount, const uint64_t& index, bool include_commitmemt) const
|
||||||
{
|
{
|
||||||
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
||||||
check_open();
|
check_open();
|
||||||
|
@ -2563,7 +2563,8 @@ output_data_t BlockchainLMDB::get_output_key(const uint64_t& amount, const uint6
|
||||||
{
|
{
|
||||||
const pre_rct_outkey *okp = (const pre_rct_outkey *)v.mv_data;
|
const pre_rct_outkey *okp = (const pre_rct_outkey *)v.mv_data;
|
||||||
memcpy(&ret, &okp->data, sizeof(pre_rct_output_data_t));;
|
memcpy(&ret, &okp->data, sizeof(pre_rct_output_data_t));;
|
||||||
ret.commitment = rct::zeroCommit(amount);
|
if (include_commitmemt)
|
||||||
|
ret.commitment = rct::zeroCommit(amount);
|
||||||
}
|
}
|
||||||
TXN_POSTFIX_RDONLY();
|
TXN_POSTFIX_RDONLY();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -242,7 +242,7 @@ public:
|
||||||
|
|
||||||
virtual uint64_t get_num_outputs(const uint64_t& amount) const;
|
virtual uint64_t get_num_outputs(const uint64_t& amount) const;
|
||||||
|
|
||||||
virtual output_data_t get_output_key(const uint64_t& amount, const uint64_t& index) const;
|
virtual output_data_t get_output_key(const uint64_t& amount, const uint64_t& index, bool include_commitmemt) const;
|
||||||
virtual void get_output_key(const epee::span<const uint64_t> &amounts, const std::vector<uint64_t> &offsets, std::vector<output_data_t> &outputs, bool allow_partial = false) const;
|
virtual void get_output_key(const epee::span<const uint64_t> &amounts, const std::vector<uint64_t> &offsets, std::vector<output_data_t> &outputs, bool allow_partial = false) const;
|
||||||
|
|
||||||
virtual tx_out_index get_output_tx_and_index_from_global(const uint64_t& index) const;
|
virtual tx_out_index get_output_tx_and_index_from_global(const uint64_t& index) const;
|
||||||
|
|
|
@ -89,7 +89,7 @@ public:
|
||||||
virtual uint64_t get_tx_block_height(const crypto::hash& h) const { return 0; }
|
virtual uint64_t get_tx_block_height(const crypto::hash& h) const { return 0; }
|
||||||
virtual uint64_t get_num_outputs(const uint64_t& amount) const { return 1; }
|
virtual uint64_t get_num_outputs(const uint64_t& amount) const { return 1; }
|
||||||
virtual uint64_t get_indexing_base() const { return 0; }
|
virtual uint64_t get_indexing_base() const { return 0; }
|
||||||
virtual cryptonote::output_data_t get_output_key(const uint64_t& amount, const uint64_t& index) const { return cryptonote::output_data_t(); }
|
virtual cryptonote::output_data_t get_output_key(const uint64_t& amount, const uint64_t& index, bool include_commitmemt) const { return cryptonote::output_data_t(); }
|
||||||
virtual cryptonote::tx_out_index get_output_tx_and_index_from_global(const uint64_t& index) const { return cryptonote::tx_out_index(); }
|
virtual cryptonote::tx_out_index get_output_tx_and_index_from_global(const uint64_t& index) const { return cryptonote::tx_out_index(); }
|
||||||
virtual cryptonote::tx_out_index get_output_tx_and_index(const uint64_t& amount, const uint64_t& index) const { return cryptonote::tx_out_index(); }
|
virtual cryptonote::tx_out_index get_output_tx_and_index(const uint64_t& amount, const uint64_t& index) const { return cryptonote::tx_out_index(); }
|
||||||
virtual void get_output_tx_and_index(const uint64_t& amount, const std::vector<uint64_t> &offsets, std::vector<cryptonote::tx_out_index> &indices) const {}
|
virtual void get_output_tx_and_index(const uint64_t& amount, const std::vector<uint64_t> &offsets, std::vector<cryptonote::tx_out_index> &indices) const {}
|
||||||
|
|
Loading…
Reference in a new issue