From 73b9b4ba34d2360228b1ff32b6a3aee9ff1134b0 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 29 Aug 2016 20:49:18 +0100 Subject: [PATCH] wallet: fix not finding enough rct fake outputs If picking coinbase outputs, those are locked for a longer time than other outputs, so we ask for more of those --- src/wallet/wallet2.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 99866dbe..d889720a 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2682,8 +2682,8 @@ void wallet2::get_outs(std::vector> &outs, const std::list> &outs, const std::listis_rct() ? 0 : it->amount(); std::unordered_set seen_indices; + // request more for rct in base recent (locked) coinbases are picked, since they're locked for longer + size_t requested_outputs_count = base_requested_outputs_count + (it->is_rct() ? CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW - CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE : 0); size_t start = req.outputs.size(); // if there are just enough outputs to mix with, use all of them. @@ -2777,6 +2779,7 @@ void wallet2::get_outs(std::vector> &outs, const std::listis_rct() ? CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW - CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE : 0); outs.push_back(std::vector()); outs.back().reserve(fake_outputs_count + 1); const rct::key mask = it->is_rct() ? rct::commit(it->amount(), it->m_mask) : rct::zeroCommit(it->amount()); @@ -2792,9 +2795,11 @@ void wallet2::get_outs(std::vector> &outs, const std::list())); + LOG_PRINT_L2("Looking for " << (fake_outputs_count+1) << " outputs of size " << print_money(it->is_rct() ? 0 : it->amount())); for (size_t o = 0; o < requested_outputs_count && outs.back().size() < fake_outputs_count + 1; ++o) { size_t i = base + order[o]; + LOG_PRINT_L2("Index " << i << "/" << requested_outputs_count << ": idx " << req.outputs[i].index << " (real " << it->m_global_output_index << "), unlocked " << daemon_resp.outs[i].unlocked << ", key " << daemon_resp.outs[i].key); if (req.outputs[i].index == it->m_global_output_index) // don't re-add real one continue; if (!daemon_resp.outs[i].unlocked) // don't add locked outs @@ -2805,7 +2810,7 @@ void wallet2::get_outs(std::vector> &outs, const std::listamount()] = outs.back().size(); + scanty_outs[it->is_rct() ? 0 : it->amount()] = outs.back().size(); } else {