diff options
author | luigi1111 <luigi1111w@gmail.com> | 2018-08-15 17:22:36 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2018-08-15 17:22:36 -0500 |
commit | 2a44c2defd485e3806af13b9e5edf0098800b35c (patch) | |
tree | 7ce7ac5d92827508c8b2fa5ee4317b93e3ac50cb /src | |
parent | Merge pull request #4148 (diff) | |
parent | wallet2: consider minimum fee when testing if balance is sufficient (diff) | |
download | monero-2a44c2defd485e3806af13b9e5edf0098800b35c.tar.xz |
Merge pull request #4150
f2e65c6 wallet2: consider minimum fee when testing if balance is sufficient (stoffu)
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/wallet2.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 52642cf82..aff29e014 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -7824,6 +7824,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp // early out if we know we can't make it anyway // we could also check for being within FEE_PER_KB, but if the fee calculation // ever changes, this might be missed, so let this go through + const uint64_t min_fee = (fee_multiplier * fee_per_kb * estimate_tx_size(use_rct, 1, fake_outs_count, 2, extra.size(), bulletproof)) / 1024; uint64_t balance_subtotal = 0; uint64_t unlocked_balance_subtotal = 0; for (uint32_t index_minor : subaddr_indices) @@ -7831,10 +7832,10 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp balance_subtotal += balance_per_subaddr[index_minor]; unlocked_balance_subtotal += unlocked_balance_per_subaddr[index_minor]; } - THROW_WALLET_EXCEPTION_IF(needed_money > balance_subtotal, error::not_enough_money, + THROW_WALLET_EXCEPTION_IF(needed_money + min_fee > balance_subtotal, error::not_enough_money, balance_subtotal, needed_money, 0); // first check overall balance is enough, then unlocked one, so we throw distinct exceptions - THROW_WALLET_EXCEPTION_IF(needed_money > unlocked_balance_subtotal, error::not_enough_unlocked_money, + THROW_WALLET_EXCEPTION_IF(needed_money + min_fee > unlocked_balance_subtotal, error::not_enough_unlocked_money, unlocked_balance_subtotal, needed_money, 0); for (uint32_t i : subaddr_indices) |