blitz_api/app/lightning
fusion44 a921686b4a
fix(lightning): clear error for undecodable/wrong-network invoices
Decoding a malformed or wrong-network invoice (e.g. a regtest lnbcrt...
invoice on a mainnet node) made each backend fail with a cryptic,
leaked error: LND with the Go 'strconv.ParseUint: parsing "rt500":
invalid syntax' surfaced as a 500, and CLN with 'Invalid bolt11: ...'.

Add a shared helper raise_for_pay_req_decode_error() in lightning/utils
that recognizes the decode-failure signatures of both backends and
raises one clear 400 pointing at the likely cause (malformed or wrong
network). Wire LND (lnd_grpc), CLN gRPC and CLN JSON-RPC through it so
they behave identically; genuine backend errors still return 500.

Fixes #225

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 18:41:18 +02:00
..
impl fix(lightning): clear error for undecodable/wrong-network invoices 2026-07-12 18:41:18 +02:00
docs.py feat: implement Ruff as a linter; fix given errors 2023-06-25 07:17:00 +02:00
exceptions.py feat: proper error handling resolving peer aliases 2023-05-01 20:48:10 +02:00
models.py refactor(lightning): migrate SendCoinsInput validator to Pydantic v2 2026-07-03 22:22:05 +02:00
router.py chore: run ruff format and isort 2025-05-06 09:16:46 +02:00
service.py refactor(api): Event enum + broadcast_msg over WebSocket 2026-07-12 18:41:18 +02:00
utils.py fix(lightning): clear error for undecodable/wrong-network invoices 2026-07-12 18:41:18 +02:00