diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-12-25 21:42:21 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-12-25 21:42:22 +0200 |
commit | 0a5bfa7c732935f24a5d81b04056129a3775bb14 (patch) | |
tree | 7477647ca3117834e6023ad81a7d8e8a3a903635 | |
parent | Merge pull request #2936 (diff) | |
parent | wallet2: reinstate the single preferred output selection (diff) | |
download | monero-0a5bfa7c732935f24a5d81b04056129a3775bb14.tar.xz |
Merge pull request #2938
aaae94f0 wallet2: reinstate the single preferred output selection (moneromooo-monero)
-rw-r--r-- | src/wallet/wallet2.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 8f5f15f9c..cf24689da 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -5731,7 +5731,19 @@ std::vector<size_t> wallet2::pick_preferred_rct_inputs(uint64_t needed_money, ui LOG_PRINT_L2("pick_preferred_rct_inputs: needed_money " << print_money(needed_money)); - // try to find two outputs + // try to find a rct input of enough size + for (size_t i = 0; i < m_transfers.size(); ++i) + { + const transfer_details& td = m_transfers[i]; + if (!td.m_spent && td.is_rct() && td.amount() >= needed_money && is_transfer_unlocked(td) && td.m_subaddr_index.major == subaddr_account && subaddr_indices.count(td.m_subaddr_index.minor) == 1) + { + LOG_PRINT_L2("We can use " << i << " alone: " << print_money(td.amount())); + picks.push_back(i); + return picks; + } + } + + // then try to find two outputs // this could be made better by picking one of the outputs to be a small one, since those // are less useful since often below the needed money, so if one can be used in a pair, // it gets rid of it for the future |