Skip to content

Conversation

@jvsena42
Copy link
Member

@jvsena42 jvsena42 commented Jan 12, 2026

Description

  • Fallback to on-chain on unified invoice when Bolt11 is expired
  • Navigation bug when scanning invalid Bolt 11. Was navigating to amount screen even without a valid on-chain address
  • Added Address/balance validation on 'Send Bitcoin' #328 checks for manual and pasting

Linked Issues/Tasks

Fix #300
Fix #328

Screenshot / Video

uniffied-expired-no-amount.mp4
invalid-input.mp4
wrong-network.mp4
fallback-to-sagings.mp4
unsuficcient-spending-failsback-to-onchain.mp4
ln-only-expired-and-insufficient-spending.mp4
expired-insufficient-savings.mp4

@jvsena42 jvsena42 self-assigned this Jan 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the handling of expired Bolt 11 invoices in unified invoices by implementing a fallback to on-chain payment when the Lightning invoice has expired. It also addresses a navigation bug where the app would incorrectly navigate to the amount screen even when scanning an invalid Bolt 11 invoice without a valid on-chain address.

Changes:

  • Added expiration checks for Lightning invoices in unified invoice handling with fallback to on-chain when expired
  • Fixed navigation logic to prevent navigation when no valid invoice data exists
  • Added expiration validation for standalone Lightning invoices

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
Bitkit/ViewModels/AppViewModel.swift Added expiration checks for Lightning invoices with on-chain fallback logic in unified invoice handling
Bitkit/Utilities/PaymentNavigationHelper.swift Changed return type to optional and added validation to prevent navigation without valid invoice data
Bitkit/Views/Wallets/Send/SendEnterManuallyView.swift Updated to handle optional navigation route from PaymentNavigationHelper
Bitkit/Views/Wallets/Send/SendConfirmationView.swift Added expiration check before processing Lightning payments

@claude

This comment has been minimized.

@ovitrif ovitrif self-requested a review January 13, 2026 13:05
ben-kaufman
ben-kaufman previously approved these changes Jan 13, 2026
Copy link
Contributor

@ben-kaufman ben-kaufman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utAck, changes look good

ovitrif
ovitrif previously approved these changes Jan 13, 2026
Copy link
Collaborator

@ovitrif ovitrif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested by applying this patch to Android app and then creating an invoice and paying it from iOS:

diff --git a/app/src/main/java/to/bitkit/repositories/LightningRepo.kt b/app/src/main/java/to/bitkit/repositories/LightningRepo.kt
index 791204e6..8c39d85c 100644
--- a/app/src/main/java/to/bitkit/repositories/LightningRepo.kt
+++ b/app/src/main/java/to/bitkit/repositories/LightningRepo.kt
@@ -574,7 +574,7 @@ class LightningRepo @Inject constructor(
     suspend fun createInvoice(
         amountSats: ULong? = null,
         description: String,
-        expirySeconds: UInt = 86_400u,
+        expirySeconds: UInt = 20u,
     ): Result<String> = executeWhenNodeRunning("createInvoice") {
         updateGeoBlockState()
         val invoice = lightningService.receive(amountSats, description, expirySeconds)

@ovitrif ovitrif enabled auto-merge January 13, 2026 15:59
@pwltr pwltr disabled auto-merge January 13, 2026 16:16
Copy link
Contributor

@pwltr pwltr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly good, please check with the react native app for the correct UX for these cases:

  • 0 balance -> should show "Insufficient Savings" toast (more relevant)
  • 0 spending balance -> fall back to onchain, no toast (or make it type .info instead)
  • Lightning invoice only -> use title & description for toast: "Decoding Error" "This Lightning invoice has expired"

@jvsena42 jvsena42 dismissed stale reviews from ovitrif and ben-kaufman via 0a0f009 January 14, 2026 10:10
@claude

This comment has been minimized.

1 similar comment
@claude

This comment has been minimized.

@claude

This comment has been minimized.

@jvsena42 jvsena42 marked this pull request as draft January 14, 2026 11:20
@jvsena42
Copy link
Member Author

Draft to also cover #328 cases

@jvsena42 jvsena42 marked this pull request as ready for review January 14, 2026 15:07
@jvsena42
Copy link
Member Author

@piotr-iohk we probably need a E2E update

@claude

This comment has been minimized.

@piotr-iohk
Copy link
Collaborator

@piotr-iohk we probably need a E2E update

Yes, it's already in place in corresponding e2e branch -> synonymdev/bitkit-e2e-tests#97

@claude

This comment has been minimized.

@jvsena42 jvsena42 requested a review from pwltr January 14, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Address/balance validation on 'Send Bitcoin' Expired Lightning in unified invoice fails instead of falling back to Bitcoin address

6 participants