forked from lthn/blockchain
fixed endless loop in decoy selection api
This commit is contained in:
parent
d8241d1531
commit
bca8a4bf16
1 changed files with 2 additions and 3 deletions
|
|
@ -2700,7 +2700,7 @@ bool blockchain_storage::get_target_outs_for_amount_prezarcanum(const COMMAND_RP
|
||||||
std::set<size_t> used;
|
std::set<size_t> used;
|
||||||
used.insert(details.own_global_index);
|
used.insert(details.own_global_index);
|
||||||
size_t try_count = 0;
|
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;
|
size_t g_index = crypto::rand<size_t>() % up_index_limit;
|
||||||
if (used.count(g_index))
|
if (used.count(g_index))
|
||||||
|
|
@ -2709,7 +2709,6 @@ bool blockchain_storage::get_target_outs_for_amount_prezarcanum(const COMMAND_RP
|
||||||
used.insert(g_index);
|
used.insert(g_index);
|
||||||
if (added)
|
if (added)
|
||||||
++j;
|
++j;
|
||||||
++try_count;
|
|
||||||
}
|
}
|
||||||
if (result_outs.outs.size() < decoys_count)
|
if (result_outs.outs.size() < decoys_count)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue