diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-11-04 20:45:59 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-11-04 20:45:59 +0200 |
commit | ae919a1e158ed35af9615c66bd4607d8043531f6 (patch) | |
tree | 3b1e3ec87f6497d145f165c92b259640a076d7d9 | |
parent | Merge pull request #4689 (diff) | |
parent | wallet2: sanity check rct output distribution from the daemon (diff) | |
download | monero-ae919a1e158ed35af9615c66bd4607d8043531f6.tar.xz |
Merge pull request #4691
7f0dd094 wallet2: sanity check rct output distribution from the daemon (moneromooo-monero)
-rw-r--r-- | src/wallet/wallet2.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 794d1d421..73a992e42 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -6709,15 +6709,21 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>> uint64_t rct_start_height; std::vector<uint64_t> rct_offsets; bool has_rct = false; + uint64_t max_rct_index = 0; for (size_t idx: selected_transfers) if (m_transfers[idx].is_rct()) - { has_rct = true; break; } + { + has_rct = true; + max_rct_index = std::max(max_rct_index, m_transfers[idx].m_global_output_index); + } const bool has_rct_distribution = has_rct && get_rct_distribution(rct_start_height, rct_offsets); if (has_rct_distribution) { // check we're clear enough of rct start, to avoid corner cases below THROW_WALLET_EXCEPTION_IF(rct_offsets.size() <= CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE, error::get_output_distribution, "Not enough rct outputs"); + THROW_WALLET_EXCEPTION_IF(rct_offsets.back() <= max_rct_index, + error::get_output_distribution, "Daemon reports suspicious number of rct outputs"); } // get histogram for the amounts we need |