diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-09-15 15:19:54 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-09-15 15:19:54 +0200 |
commit | ce5367452063e4e74e8a690d876274b9395eef69 (patch) | |
tree | 447161d53d5f86eb435df8b924dfeeca18373c2b /src/wallet | |
parent | Merge pull request #1066 (diff) | |
parent | wallet: fix misdetection of duplicates (diff) | |
download | monero-ce5367452063e4e74e8a690d876274b9395eef69.tar.xz |
Merge pull request #1067
70b78bb wallet: fix misdetection of duplicates (moneromooo-monero)
7d413f6 rct: rework serialization to avoid storing vector sizes (moneromooo-monero)
0ce79ef core: cleanup some typecasting (moneromooo-monero)
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/wallet2.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index a195abde6..01892dc49 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2806,9 +2806,10 @@ void wallet2::get_outs(std::vector<std::vector<entry>> &outs, const std::list<tr continue; if (!daemon_resp.outs[i].unlocked) // don't add locked outs continue; - if (o > 0 && daemon_resp.outs[i].key == daemon_resp.outs[i - 1].key) // don't add duplicates + auto item = std::make_tuple(req.outputs[i].index, daemon_resp.outs[i].key, daemon_resp.outs[i].mask); + if (std::find(outs.back().begin(), outs.back().end(), item) != outs.back().end()) // don't add duplicates continue; - outs.back().push_back(std::make_tuple(req.outputs[i].index, daemon_resp.outs[i].key, daemon_resp.outs[i].mask)); + outs.back().push_back(item); } if (outs.back().size() < fake_outputs_count + 1) { @@ -2818,15 +2819,6 @@ void wallet2::get_outs(std::vector<std::vector<entry>> &outs, const std::list<tr { // sort the subsection, so any spares are reset in order std::sort(outs.back().begin(), outs.back().end(), [](const entry &a, const entry &b) { return std::get<0>(a) < std::get<0>(b); }); - - // sanity check - for (size_t n = 1; n < outs.back().size(); ++n) - { - THROW_WALLET_EXCEPTION_IF(std::get<0>(outs.back()[n]) == std::get<0>(outs.back()[n-1]), error::wallet_internal_error, - "Duplicate indices though we did not ask for any"); - THROW_WALLET_EXCEPTION_IF(std::get<1>(outs.back()[n]) == std::get<1>(outs.back()[n-1]), error::wallet_internal_error, - "Duplicate keys after we have weeded them out"); - } } base += requested_outputs_count; } |