Merge pull request #9260

8703b8a wallet2: ensure transfers and sweeps use same fee calc logic rnd2 (j-berman)
This commit is contained in:
luigi1111 2024-05-20 23:33:31 -05:00
commit b85f320738
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010

View File

@ -11119,8 +11119,8 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
else 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)); 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; size_t fee_tries = 0;
for (fee_tries = 0; fee_tries < 10 && needed_fee > test_ptx.fee; ++fee_tries) { do {
tx_dsts = tx.get_adjusted_dsts(needed_fee); tx_dsts = tx.get_adjusted_dsts(needed_fee);
if (use_rct) if (use_rct)
@ -11133,7 +11133,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); 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) << 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"); " 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, THROW_WALLET_EXCEPTION_IF(fee_tries == 10, error::wallet_internal_error,
"Too many attempts to raise pending tx fee to level of needed fee"); "Too many attempts to raise pending tx fee to level of needed fee");