Merge pull request #363

4f19e68 blockchain: factor get_num_outpouts(amount) calls (moneromooo-monero)
275894c blockchain: always select random outs using triangular distribution (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2015-08-10 20:04:30 +02:00
commit 09cada45c4
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
6 changed files with 12 additions and 38 deletions

View file

@ -1264,19 +1264,6 @@ uint64_t BlockchainBDB::get_tx_block_height(const crypto::hash& h) const
return (uint64_t)result - 1;
}
//FIXME: make sure the random method used here is appropriate
uint64_t BlockchainBDB::get_random_output(const uint64_t& amount) const
{
LOG_PRINT_L3("BlockchainBDB::" << __func__);
check_open();
uint64_t num_outputs = get_num_outputs(amount);
if (num_outputs == 0)
throw1(OUTPUT_DNE("Attempting to get a random output for an amount, but none exist"));
return crypto::rand<uint64_t>() % num_outputs;
}
uint64_t BlockchainBDB::get_num_outputs(const uint64_t& amount) const
{
LOG_PRINT_L3("BlockchainBDB::" << __func__);

View file

@ -295,8 +295,6 @@ public:
virtual uint64_t get_tx_block_height(const crypto::hash& h) const;
virtual uint64_t get_random_output(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);

View file

@ -104,7 +104,6 @@
* height get_tx_block_height(hash)
*
* Outputs:
* index get_random_output(amount)
* uint64_t get_num_outputs(amount)
* pub_key get_output_key(amount, index)
* tx_out get_output(tx_hash, index)
@ -463,9 +462,6 @@ public:
// returns height of block that contains transaction with hash <h>
virtual uint64_t get_tx_block_height(const crypto::hash& h) const = 0;
// return global output index of a random output of amount <amount>
virtual uint64_t get_random_output(const uint64_t& amount) const = 0;
// returns the total number of outputs of amount <amount>
virtual uint64_t get_num_outputs(const uint64_t& amount) const = 0;

View file

@ -1637,19 +1637,6 @@ uint64_t BlockchainLMDB::get_tx_block_height(const crypto::hash& h) const
return *(const uint64_t*)result.mv_data;
}
//FIXME: make sure the random method used here is appropriate
uint64_t BlockchainLMDB::get_random_output(const uint64_t& amount) const
{
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
check_open();
uint64_t num_outputs = get_num_outputs(amount);
if (num_outputs == 0)
throw1(OUTPUT_DNE("Attempting to get a random output for an amount, but none exist"));
return crypto::rand<uint64_t>() % num_outputs;
}
uint64_t BlockchainLMDB::get_num_outputs(const uint64_t& amount) const
{
LOG_PRINT_L3("BlockchainLMDB::" << __func__);

View file

@ -157,8 +157,6 @@ public:
virtual uint64_t get_tx_block_height(const crypto::hash& h) const;
virtual uint64_t get_random_output(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);