mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-27 05:13:25 +01:00
output rng fix from boolberry
This commit is contained in:
parent
8779a6da39
commit
08205f01d9
@ -1006,7 +1006,6 @@ size_t blockchain_storage::find_end_of_allowed_index(const std::vector<std::pair
|
|||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
bool blockchain_storage::get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res)
|
bool blockchain_storage::get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res)
|
||||||
{
|
{
|
||||||
srand(static_cast<unsigned int>(time(NULL)));
|
|
||||||
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
||||||
BOOST_FOREACH(uint64_t amount, req.amounts)
|
BOOST_FOREACH(uint64_t amount, req.amounts)
|
||||||
{
|
{
|
||||||
@ -1029,7 +1028,7 @@ bool blockchain_storage::get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDO
|
|||||||
size_t try_count = 0;
|
size_t try_count = 0;
|
||||||
for(uint64_t j = 0; j != req.outs_count && try_count < up_index_limit;)
|
for(uint64_t j = 0; j != req.outs_count && try_count < up_index_limit;)
|
||||||
{
|
{
|
||||||
size_t i = rand()%up_index_limit;
|
size_t i = crypto::rand<size_t>()%up_index_limit;
|
||||||
if(used.count(i))
|
if(used.count(i))
|
||||||
continue;
|
continue;
|
||||||
bool added = add_out_to_get_random_outs(amount_outs, result_outs, amount, i);
|
bool added = add_out_to_get_random_outs(amount_outs, result_outs, amount, i);
|
||||||
|
Loading…
Reference in New Issue
Block a user