1
0
Fork 0
forked from lthn/blockchain

fixed endless loop in decoy selection api

This commit is contained in:
cryptozoidberg 2024-01-18 19:16:30 +01:00
parent d8241d1531
commit bca8a4bf16
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC

View file

@ -2700,7 +2700,7 @@ bool blockchain_storage::get_target_outs_for_amount_prezarcanum(const COMMAND_RP
std::set<size_t> used;
used.insert(details.own_global_index);
size_t try_count = 0;
for (uint64_t j = 0; j != decoys_count && try_count < up_index_limit;)
for (uint64_t j = 0; j != decoys_count && try_count++ < up_index_limit;)
{
size_t g_index = crypto::rand<size_t>() % up_index_limit;
if (used.count(g_index))
@ -2708,8 +2708,7 @@ bool blockchain_storage::get_target_outs_for_amount_prezarcanum(const COMMAND_RP
bool added = add_out_to_get_random_outs(result_outs, amount, g_index, decoys_count, req.use_forced_mix_outs, req.height_upper_limit);
used.insert(g_index);
if (added)
++j;
++try_count;
++j;
}
if (result_outs.outs.size() < decoys_count)
{