mirror of
https://github.com/monero-project/monero.git
synced 2024-11-18 00:37:43 +00:00
Merge pull request #3530
eb59f7c5
cryptonote_tx_util: make destinations properly shuffled (stoffu)
This commit is contained in:
commit
226de8e928
1 changed files with 3 additions and 2 deletions
|
@ -29,6 +29,7 @@
|
|||
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
|
||||
#include <unordered_set>
|
||||
#include <random>
|
||||
#include "include_base_utils.h"
|
||||
#include "string_tools.h"
|
||||
using namespace epee;
|
||||
|
@ -316,7 +317,7 @@ namespace cryptonote
|
|||
|
||||
// "Shuffle" outs
|
||||
std::vector<tx_destination_entry> shuffled_dsts(destinations);
|
||||
std::random_shuffle(shuffled_dsts.begin(), shuffled_dsts.end(), [](unsigned int i) { return crypto::rand<unsigned int>() % i; });
|
||||
std::shuffle(shuffled_dsts.begin(), shuffled_dsts.end(), std::default_random_engine(crypto::rand<unsigned int>()));
|
||||
|
||||
// sort ins by their key image
|
||||
std::vector<size_t> ins_order(sources.size());
|
||||
|
@ -363,7 +364,7 @@ namespace cryptonote
|
|||
uint64_t summary_outs_money = 0;
|
||||
//fill outputs
|
||||
size_t output_index = 0;
|
||||
for(const tx_destination_entry& dst_entr: destinations)
|
||||
for(const tx_destination_entry& dst_entr: shuffled_dsts)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(dst_entr.amount > 0 || tx.version > 1, false, "Destination with wrong amount: " << dst_entr.amount);
|
||||
crypto::key_derivation derivation;
|
||||
|
|
Loading…
Reference in a new issue