mirror of
https://github.com/monero-project/monero.git
synced 2024-12-14 04:16:32 +02:00
Merge pull request #4150
f2e65c6
wallet2: consider minimum fee when testing if balance is sufficient (stoffu)
This commit is contained in:
commit
2a44c2defd
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user