aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core
diff options
context:
space:
mode:
authorstoffu <stoffu@protonmail.ch>2018-03-31 16:19:14 +0900
committerstoffu <stoffu@protonmail.ch>2018-03-31 18:37:46 +0900
commiteb59f7c5630f80715af30453c31fd2dfc85944ad (patch)
tree60958ab0d1f5d80a2891c838987a2e08b378d4fb /src/cryptonote_core
parentREADME: add instructions for cloning / submodules (diff)
downloadmonero-eb59f7c5630f80715af30453c31fd2dfc85944ad.tar.xz
cryptonote_tx_util: make destinations properly shuffled
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r--src/cryptonote_core/cryptonote_tx_utils.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp
index db4ab9e11..c2252fcc7 100644
--- a/src/cryptonote_core/cryptonote_tx_utils.cpp
+++ b/src/cryptonote_core/cryptonote_tx_utils.cpp
@@ -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;