Skip to content

Commit

Permalink
wallet2: ensure transfers and sweeps use same fee calc logic rnd2
Browse files Browse the repository at this point in the history
Looks like the logic from monero-project#8882 was accidentally removed in monero-project#8861
(regressing to the behavior noted in the monero-project#8882 description).
This commit brings that logic back.
  • Loading branch information
j-berman committed Mar 22, 2024
1 parent c821478 commit 427ba77
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/wallet/wallet2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10422,8 +10422,8 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
else
{
LOG_PRINT_L2("We made a tx, adjusting fee and saving it, we need " << print_money(needed_fee) << " and we have " << print_money(test_ptx.fee));
size_t fee_tries;
for (fee_tries = 0; fee_tries < 10 && needed_fee > test_ptx.fee; ++fee_tries) {
size_t fee_tries = 0;
do {
tx_dsts = tx.get_adjusted_dsts(needed_fee);

if (use_rct)
Expand All @@ -10436,7 +10436,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
needed_fee = calculate_fee(use_per_byte_fee, test_ptx.tx, txBlob.size(), base_fee, fee_quantization_mask);
LOG_PRINT_L2("Made an attempt at a final " << get_weight_string(test_ptx.tx, txBlob.size()) << " tx, with " << print_money(test_ptx.fee) <<
" fee and " << print_money(test_ptx.change_dts.amount) << " change");
};
} while (needed_fee > test_ptx.fee && ++fee_tries < 10);

THROW_WALLET_EXCEPTION_IF(fee_tries == 10, error::wallet_internal_error,
"Too many attempts to raise pending tx fee to level of needed fee");
Expand Down

0 comments on commit 427ba77

Please sign in to comment.