blitz_api/app/lightning/impl
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
..
protos chore: update deps and flake file 2024-12-16 15:20:46 +01:00
specializations fix(lightning): prevent shell injection in CLN local calls 2026-07-03 19:58:41 +02:00
__init__.py refactor: switch to domain driven directory layout 2022-10-03 20:22:00 +02:00
cln_grpc.py fix(lightning): clear error for undecodable/wrong-network invoices 2026-07-12 18:41:18 +02:00
cln_jrpc.py fix(lightning): clear error for undecodable/wrong-network invoices 2026-07-12 18:41:18 +02:00
cln_utils.py feat: implement Ruff as a linter; fix given errors 2023-06-25 07:17:00 +02:00
ln_base.py refactor: switch to domain driven directory layout 2022-10-03 20:22:00 +02:00
lnd_grpc.py fix(lightning): clear error for undecodable/wrong-network invoices 2026-07-12 18:41:18 +02:00