Skip to content

Commit 0ead374

Browse files
committed
refactor: improve suggested fee calc
1 parent 0764bb0 commit 0ead374

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/src/main/java/to/bitkit/ui/screens/wallets/activity/BoostTransactionViewModel.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,13 @@ class BoostTransactionViewModel @Inject constructor(
8181
PaymentType.RECEIVED -> lightningRepo.calculateCpfpFeeRate(activityContent.txId)
8282
}
8383

84-
// TODO ideally include utxos for a better fee estimate
84+
val sortedUtxos = lightningRepo.listSpendableOutputs()
85+
.getOrDefault(emptyList())
86+
.sortedByDescending { it.valueSats }
87+
8588
val totalFeeResult = lightningRepo.calculateTotalFee(
8689
amountSats = activityContent.value,
90+
utxosToSpend = sortedUtxos,
8791
speed = TransactionSpeed.Custom(feeRateResult.getOrDefault(0u).toUInt()),
8892
)
8993

0 commit comments

Comments
 (0)