Calculate fee amount from fee rate if available

OmarHatem committed Dec 16, 2022 at 19:21 UTC 7ffb654065add7d4fe668cfd36a5ed0902152952
1 file changed +4 -2
cw_bitcoin/lib/electrum_wallet.dart
+4 -2
@@ -191,8 +191,10 @@ abstract class ElectrumWalletBase extends WalletBase<ElectrumBalance,
191 throw BitcoinTransactionNoInputsException();
192 }
193
194 - final allAmountFee = feeAmountForPriority(
195 - transactionCredentials.priority!, inputs.length, outputs.length);
194 + final allAmountFee = transactionCredentials.feeRate != null
195 + ? feeAmountWithFeeRate(transactionCredentials.feeRate!, inputs.length, outputs.length)
196 + : feeAmountForPriority(transactionCredentials.priority!, inputs.length, outputs.length);
197 +
198 final allAmount = allInputsAmount - allAmountFee;
199
200 var credentialsAmount = 0;