mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +00:00
Fix edge case of sending amount that will leave near dust amount as a change (#2044)
This commit is contained in:
parent
dcd978eb38
commit
f28af937ec
1 changed files with 5 additions and 2 deletions
|
@ -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(
|
return EstimatedTxResult(
|
||||||
utxos: utxoDetails.utxos,
|
utxos: utxoDetails.utxos,
|
||||||
inputPrivKeyInfos: utxoDetails.inputPrivKeyInfos,
|
inputPrivKeyInfos: utxoDetails.inputPrivKeyInfos,
|
||||||
|
@ -1366,7 +1370,7 @@ abstract class ElectrumWalletBase
|
||||||
List<BitcoinUnspent> updatedUnspentCoins = [];
|
List<BitcoinUnspent> updatedUnspentCoins = [];
|
||||||
|
|
||||||
final previousUnspentCoins = List<BitcoinUnspent>.from(unspentCoins.where((utxo) =>
|
final previousUnspentCoins = List<BitcoinUnspent>.from(unspentCoins.where((utxo) =>
|
||||||
utxo.bitcoinAddressRecord.type != SegwitAddresType.mweb &&
|
utxo.bitcoinAddressRecord.type != SegwitAddresType.mweb &&
|
||||||
utxo.bitcoinAddressRecord is! BitcoinSilentPaymentAddressRecord));
|
utxo.bitcoinAddressRecord is! BitcoinSilentPaymentAddressRecord));
|
||||||
|
|
||||||
if (hasSilentPaymentsScanning) {
|
if (hasSilentPaymentsScanning) {
|
||||||
|
@ -1424,7 +1428,6 @@ abstract class ElectrumWalletBase
|
||||||
required List<BitcoinUnspent> updatedUnspentCoins,
|
required List<BitcoinUnspent> updatedUnspentCoins,
|
||||||
required List<List<BitcoinUnspent>?> results,
|
required List<List<BitcoinUnspent>?> results,
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
if (failedCount == results.length) {
|
if (failedCount == results.length) {
|
||||||
printV("All UTXOs failed to fetch, falling back to previous UTXOs");
|
printV("All UTXOs failed to fetch, falling back to previous UTXOs");
|
||||||
return previousUnspentCoins;
|
return previousUnspentCoins;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue