diff options
author | Riccardo Spagni <ric@spagni.net> | 2019-05-02 11:29:25 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2019-05-02 11:29:25 +0200 |
commit | efd2412e772d7a63c0c15a2ce1831f159d90e802 (patch) | |
tree | c9836f797cc3cf29189f9982698002842813abfa /src | |
parent | Merge pull request #5484 (diff) | |
parent | wallet2: default to trying to keep 5 outputs of 2+ monero (diff) | |
download | monero-efd2412e772d7a63c0c15a2ce1831f159d90e802.tar.xz |
Merge pull request #5489
64983fce wallet2: default to trying to keep 5 outputs of 2+ monero (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/wallet2.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 6554ef7d5..0a5d34e77 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -131,6 +131,9 @@ using namespace cryptonote; #define GAMMA_SHAPE 19.28 #define GAMMA_SCALE (1/1.61) +#define DEFAULT_MIN_OUTPUT_COUNT 5 +#define DEFAULT_MIN_OUTPUT_VALUE (2*COIN) + static const std::string MULTISIG_SIGNATURE_MAGIC = "SigMultisigPkV1"; static const std::string MULTISIG_EXTRA_INFO_MAGIC = "MultisigxV1"; @@ -9375,9 +9378,16 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp idx = pop_best_value(indices, tx.selected_transfers, true); // we might not want to add it if it's a large output and we don't have many left - if (m_transfers[idx].amount() >= m_min_output_value) { - if (get_count_above(m_transfers, *unused_transfers_indices, m_min_output_value) < m_min_output_count) { - LOG_PRINT_L2("Second output was not strictly needed, and we're running out of outputs above " << print_money(m_min_output_value) << ", not adding"); + uint64_t min_output_value = m_min_output_value; + uint32_t min_output_count = m_min_output_count; + if (min_output_value == 0 && min_output_count == 0) + { + min_output_value = DEFAULT_MIN_OUTPUT_VALUE; + min_output_count = DEFAULT_MIN_OUTPUT_COUNT; + } + if (m_transfers[idx].amount() >= min_output_value) { + if (get_count_above(m_transfers, *unused_transfers_indices, min_output_value) < min_output_count) { + LOG_PRINT_L2("Second output was not strictly needed, and we're running out of outputs above " << print_money(min_output_value) << ", not adding"); break; } } |