Fix edge case of sending amount that will leave near dust amount as a change (#2044)

This commit is contained in:
Omar Hatem 2025-03-04 19:12:19 +02:00 committed by GitHub
parent dcd978eb38
commit f28af937ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -915,6 +915,10 @@ abstract class ElectrumWalletBase
}
}
// if the amount left for change is less than dust, but not less than 0
// then add it to the fees
fee += amountLeftForChange;
return EstimatedTxResult(
utxos: utxoDetails.utxos,
inputPrivKeyInfos: utxoDetails.inputPrivKeyInfos,
@ -1424,7 +1428,6 @@ abstract class ElectrumWalletBase
required List<BitcoinUnspent> updatedUnspentCoins,
required List<List<BitcoinUnspent>?> results,
}) {
if (failedCount == results.length) {
printV("All UTXOs failed to fetch, falling back to previous UTXOs");
return previousUnspentCoins;