aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-07-25 18:42:55 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-07-25 18:57:57 +0100
commit340feedee22f8407884b1a98ae37219541ab0eb2 (patch)
treecc65f6098c077a9c553a1332c757f3c2cd78aca3
parentMerge pull request #2159 (diff)
downloadmonero-340feedee22f8407884b1a98ae37219541ab0eb2.tar.xz
core: randomly shuffle outputs
They used to be sorted by amount, which was fine before rct, but is now suboptimal, since amounts are not known anymore. In particular, it would give a recipient knowledge of whether change was higher or lower than the amount received.
-rw-r--r--src/cryptonote_core/cryptonote_tx_utils.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp
index 26d5fb767..abb4b31ec 100644
--- a/src/cryptonote_core/cryptonote_tx_utils.cpp
+++ b/src/cryptonote_core/cryptonote_tx_utils.cpp
@@ -265,7 +265,7 @@ namespace cryptonote
// "Shuffle" outs
std::vector<tx_destination_entry> shuffled_dsts(destinations);
- std::sort(shuffled_dsts.begin(), shuffled_dsts.end(), [](const tx_destination_entry& de1, const tx_destination_entry& de2) { return de1.amount < de2.amount; } );
+ std::random_shuffle(shuffled_dsts.begin(), shuffled_dsts.end(), [](int i) { return crypto::rand<int>() % i; });
uint64_t summary_outs_money = 0;
//fill outputs