blitz_api/app
Justin Sharp 6b3acf0239 fix: handle missing fields in CLN invoice data gracefully
Fixes #129, #128, and addresses part of raspiblitz/raspiblitz#3182

BOLT12 offers, keysend payments, and certain CLN invoice types don't
always include all fields that the API expects, causing KeyError
exceptions that crash the web interface.

Changes:
- Modified Invoice.from_cln_json() to use .get() with safe defaults
  for all potentially missing fields (bolt11, amount_msat, payment_hash,
  description, label, status, etc.)
- Added fallback logic for amount_msat to use amount_received_msat
  when the primary field is missing
- Enhanced InvoiceState.from_cln_json() to handle unknown/missing
  statuses gracefully with logging instead of raising exceptions

This allows the web interface to display all CLN invoices including
BOLT12 payments from services like OCEAN mining pool, while preserving
all existing payment data for standard BOLT11 invoices.

Tested on RaspiBlitz v1.12.0 with Core Lightning and OCEAN mining
pool BOLT12 payouts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 10:00:05 +01:00
..
api fix: increase timeout for fetching app statuses 2025-08-08 18:27:48 +02:00
apps fix: increase timeout for fetching app statuses 2025-08-08 18:27:48 +02:00
auth feat: make config loading more flexible 2025-03-23 17:43:39 +01:00
bitcoind chore: small fixes and updates 2025-05-06 09:16:46 +02:00
external chore: run ruff format and isort 2025-05-06 09:16:46 +02:00
lightning fix: handle missing fields in CLN invoice data gracefully 2025-11-10 10:00:05 +01:00
setup feat: replace call_script func with better func 2025-05-06 09:16:46 +02:00
system feat: replace call_script func with better func 2025-05-06 09:16:46 +02:00
__init__.py feat: prepare for release 0.5.1beta 2023-02-05 21:24:31 +01:00
celery_app.py feat: fetch app status via a celery task 2025-05-06 09:16:46 +02:00
logging.py feat: make config loading more flexible 2025-03-23 17:43:39 +01:00
main.py fix: don't stop app status listener 2025-05-06 09:16:46 +02:00
server.py chore: small fixes and updates 2025-05-06 09:16:46 +02:00