mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-23 03:38:53 +00:00
Merge pull request #5501
b4ca72dd
wallet2: fix infinite loop picking outputs in corner case (moneromooo-monero)
This commit is contained in:
commit
ebb1c03e8c
@ -1003,7 +1003,7 @@ uint64_t gamma_picker::pick()
|
|||||||
const uint64_t n_rct = rct_offsets[index] - first_rct;
|
const uint64_t n_rct = rct_offsets[index] - first_rct;
|
||||||
if (n_rct == 0)
|
if (n_rct == 0)
|
||||||
return std::numeric_limits<uint64_t>::max(); // bad pick
|
return std::numeric_limits<uint64_t>::max(); // bad pick
|
||||||
MDEBUG("Picking 1/" << n_rct << " in block " << index);
|
MTRACE("Picking 1/" << n_rct << " in block " << index);
|
||||||
return first_rct + crypto::rand_idx(n_rct);
|
return first_rct + crypto::rand_idx(n_rct);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -7761,7 +7761,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_outs <= requested_outputs_count && !existing_ring_found)
|
if (num_outs <= requested_outputs_count)
|
||||||
{
|
{
|
||||||
for (uint64_t i = 0; i < num_outs; i++)
|
for (uint64_t i = 0; i < num_outs; i++)
|
||||||
req.outputs.push_back({amount, i});
|
req.outputs.push_back({amount, i});
|
||||||
@ -7787,6 +7787,8 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
|
|||||||
// while we still need more mixins
|
// while we still need more mixins
|
||||||
uint64_t num_usable_outs = num_outs;
|
uint64_t num_usable_outs = num_outs;
|
||||||
bool allow_blackballed = false;
|
bool allow_blackballed = false;
|
||||||
|
MDEBUG("Starting gamma picking with " << num_outs << ", num_usable_outs " << num_usable_outs
|
||||||
|
<< ", requested_outputs_count " << requested_outputs_count);
|
||||||
while (num_found < requested_outputs_count)
|
while (num_found < requested_outputs_count)
|
||||||
{
|
{
|
||||||
// if we've gone through every possible output, we've gotten all we can
|
// if we've gone through every possible output, we've gotten all we can
|
||||||
@ -7886,6 +7888,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
|
|||||||
picks[type].insert(i);
|
picks[type].insert(i);
|
||||||
req.outputs.push_back({amount, i});
|
req.outputs.push_back({amount, i});
|
||||||
++num_found;
|
++num_found;
|
||||||
|
MDEBUG("picked " << i << ", " << num_found << " now picked");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &pick: picks)
|
for (const auto &pick: picks)
|
||||||
|
Loading…
Reference in New Issue
Block a user