Skip to content

fix: lnurl and quickpay msat amount conversion#514

Open
ovitrif wants to merge 3 commits intofix/msat-invoice-precisionfrom
fix/lnurl-amount-rounding
Open

fix: lnurl and quickpay msat amount conversion#514
ovitrif wants to merge 3 commits intofix/msat-invoice-precisionfrom
fix/lnurl-amount-rounding

Conversation

@ovitrif
Copy link
Copy Markdown
Collaborator

@ovitrif ovitrif commented Apr 6, 2026

Summary

  • Port Android's LNURL amount helpers (isFixedAmount, callbackAmountMsats, minSendableSat, maxSendableSat) to iOS as extensions on LnurlPayData and LnurlWithdrawData
  • Fix sub-sat edge cases where min/max msat values map to an inverted sat range after rounding (e.g. min=222222, max=222538minSat=223, maxSat=222) — these are now correctly treated as fixed-amount requests
  • Fix LNURL quickpay: the guard required scannedLightningInvoice (always nil for LNURL pay), and the amount wasn't displayed on the quickpay screen

Stacked on #512

Preview

  1. LNURL-Pay minSendable=222222&maxSendable=222538 QuickPay=OFF
    1. LNURL-Pay minSendable=222222&maxSendable=222538 QuickPay=ON
Simulator.2026-04-06.004948.mp4

Test plan

Use synonymdev/bitkit-docker#6:

  • LNURL-Pay (QuickPay ON & OFF) msat range:
    http://localhost:3000/generate/pay?minSendable=222222&maxSendable=222538
    
  • LNURL-Withdraw msat range:
    http://localhost:3000/generate/withdraw?minWithdrawable=22222&maxWithdrawable=22522
    
  • Bolt11 with msat amount (QuickPay ON & OFF)
    ./bitcoin-cli bolt11 33333 --msat
    
  • regression: Bolt11 zero-amount invoice
    ./bitcoin-cli bolt11
    

🤖 Generated with Claude Code

@ovitrif ovitrif added this to the 2.2.0 milestone Apr 6, 2026
@ovitrif ovitrif self-assigned this Apr 6, 2026
@ovitrif ovitrif changed the title fix: LNURL amount rounding and quickpay for sub-sat ranges fix: lnurl and quickpay msat amount rounding and comparison Apr 6, 2026
@ovitrif ovitrif changed the title fix: lnurl and quickpay msat amount rounding and comparison fix: lnurl and quickpay msat amount conversion Apr 6, 2026
@claude

This comment has been minimized.

ovitrif and others added 3 commits April 6, 2026 03:16
Port Android's LNURL amount helpers (isFixedAmount, callbackAmountMsats,
minSendableSat, maxSendableSat, etc.) to iOS via extensions on
LnurlPayData and LnurlWithdrawData.

This fixes sub-sat edge cases where min/max msat values map to an
inverted sat range after rounding (e.g. min=222222, max=222538 →
minSat=223, maxSat=222). These are now correctly treated as fixed-amount
requests and routed to the confirm screen instead of the amount picker.

Also fixes LNURL quickpay guard that required scannedLightningInvoice
(always nil for LNURL pay flows), and centralizes all msat→sat
conversions for LNURL amounts in the new extension file.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The quickpay view only displayed the amount for bolt11 invoices
(scannedLightningInvoice). For LNURL pay, the invoice doesn't exist
yet at that point — the amount comes from lnurlPayData.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ovitrif ovitrif force-pushed the fix/lnurl-amount-rounding branch from aaa2240 to e2d0056 Compare April 6, 2026 01:16
@claude
Copy link
Copy Markdown

claude bot commented Apr 6, 2026

Code review

CLAUDE.md Compliance: Missing changelog entry

This is a fix: PR, but CHANGELOG.md was not updated. Per CLAUDE.md:

ALWAYS add exactly ONE entry per PR under ## [Unreleased] in CHANGELOG.md for feat: and fix: PRs

Please add an entry under ## [Unreleased]### Fixed, for example:

### Fixed

- Fix LNURL and quickpay msat amount conversion, handling sub-sat edge cases and quickpay guard for LNURL pay flows #514

No other issues found. Checked for bugs and CLAUDE.md compliance.

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.

1 participant