mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
wallet2: sanity check rct output distribution from the daemon
This commit is contained in:
parent
2287fb9fb4
commit
7f0dd094e7
1 changed files with 7 additions and 1 deletions
|
@ -6683,15 +6683,21 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
|
||||||
uint64_t rct_start_height;
|
uint64_t rct_start_height;
|
||||||
std::vector<uint64_t> rct_offsets;
|
std::vector<uint64_t> rct_offsets;
|
||||||
bool has_rct = false;
|
bool has_rct = false;
|
||||||
|
uint64_t max_rct_index = 0;
|
||||||
for (size_t idx: selected_transfers)
|
for (size_t idx: selected_transfers)
|
||||||
if (m_transfers[idx].is_rct())
|
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);
|
const bool has_rct_distribution = has_rct && get_rct_distribution(rct_start_height, rct_offsets);
|
||||||
if (has_rct_distribution)
|
if (has_rct_distribution)
|
||||||
{
|
{
|
||||||
// check we're clear enough of rct start, to avoid corner cases below
|
// 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,
|
THROW_WALLET_EXCEPTION_IF(rct_offsets.size() <= CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE,
|
||||||
error::get_output_distribution, "Not enough rct outputs");
|
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
|
// get histogram for the amounts we need
|
||||||
|
|
Loading…
Reference in a new issue