Skip to content

Commit 03f1e33

Browse files
committed
fix: add expired invoice check to unified invoice
1 parent fdc6eaa commit 03f1e33

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,21 @@ class AppViewModel @Inject constructor(
719719
?.let { it as? Scanner.Lightning }
720720
?.invoice
721721
?.takeIf { invoice ->
722+
if (invoice.isExpired) {
723+
toast(
724+
type = Toast.ToastType.ERROR,
725+
title = context.getString(R.string.other__scan_err_decoding),
726+
description = context.getString(R.string.other__scan__error__expired),
727+
)
728+
729+
Logger.debug(
730+
"Lightning invoice expired in unified URI, defaulting to onchain-only",
731+
context = TAG
732+
)
733+
return@takeIf false
734+
}
735+
736+
// Then check sending capacity
722737
val canSend = lightningRepo.canSend(invoice.amountSatoshis.coerceAtLeast(1u))
723738
if (!canSend) {
724739
Logger.debug("Cannot pay unified invoice using LN, defaulting to onchain-only", context = TAG)

0 commit comments

Comments
 (0)