From 7fc6fa3fa2e0243e54513c8c78c404e7969d0747 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 31 Jan 2016 11:03:09 +0000 Subject: wallet: forbid dust altogether in output selection where appropriate --- src/wallet/wallet2.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/wallet/wallet2.cpp') diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index d636b0e4b..2a71f79c5 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -1515,7 +1515,7 @@ namespace // returns: // direct return: amount of money found // modified reference: selected_transfers, a list of iterators/indices of input sources -uint64_t wallet2::select_transfers(uint64_t needed_money, bool add_dust, uint64_t dust, std::list& selected_transfers) +uint64_t wallet2::select_transfers(uint64_t needed_money, bool add_dust, uint64_t dust, bool hf2_rules, std::list& selected_transfers) { std::vector unused_transfers_indices; std::vector unused_dust_indices; @@ -1530,7 +1530,15 @@ uint64_t wallet2::select_transfers(uint64_t needed_money, bool add_dust, uint64_ if (dust < td.amount() && is_valid_decomposed_amount(td.amount())) unused_transfers_indices.push_back(i); else - unused_dust_indices.push_back(i); + { + // for hf2 rules, we disregard dust, which will be spendable only + // via sweep_dust. If we're asked to add dust, though, we still + // consider them, as this will be a mixin 0 tx (and thus we may + // end up with a tx with one mixable output and N dusty ones). + // This should be made better at some point... + if (!hf2_rules || add_dust) + unused_dust_indices.push_back(i); + } } } -- cgit v1.2.3