Skip to content

fix: use decode instead of deprecated decodepay in CLN backends#318

Open
sharpone74 wants to merge 1 commit into
fusion44:devfrom
sharpone74:fix-cln-decodepay-deprecated
Open

fix: use decode instead of deprecated decodepay in CLN backends#318
sharpone74 wants to merge 1 commit into
fusion44:devfrom
sharpone74:fix-cln-decodepay-deprecated

Conversation

@sharpone74

Copy link
Copy Markdown
Contributor

Follow-up in the same spirit as #290 / #307 — this time the Transactions breakage comes from CLN retiring an RPC out from under us.

Both CLN backends decode payment requests via decodepay:

res = await self._send_request("decodepay", params)              # cln_jrpc.py
res = await _make_local_call("decodepay", f"bolt11={pay_req}")   # cln_grpc.py

CLN deprecated decodepay in favor of decode in v24.11, now rejects it by default (observed on v25.12.1: JSON-RPC -32601 'Command "decodepay" is deprecated'), and removes it entirely in v26.04 (ElementsProject/lightning#8850). Since decode_pay_request is called for every invoice in the payment history, list_all_tx() fails wholesale and /lightning/list-all-tx returns HTTP 500 on every poll — the Transactions view in the web UI is permanently broken against current CLN.

Fix

  • Call decode instead of decodepay in both cln_jrpc.py and cln_grpc.py (the CLI fallback's keyword changes from bolt11= to string=). For bolt11 invoices decode returns a superset of decodepay's fields, so PaymentRequest.from_cln_json needs no changes.
  • Guard the one behavioral difference: decode reports recognized-but-invalid strings as a normal result with valid=false + warning_* fields instead of an RPC error. Unhandled, that would resurface the fix: handle missing bolt11 in CLN list_payments for keysend/BOLT12 #307 failure mode (KeyError swallowed by @logger.catchNoneTypeError in list_all_tx), so both backends map valid=false to a clear 400 with the warnings as detail.

Reproduction

  • RaspiBlitz v1.12.1 / Core Lightning v25.12.1
  • Open the Transactions tab in the web UI → 500 on every 20 s poll:
    2026-07-20 12:10:19 | ❌ | cln_jrpc.py:490 | Command "decodepay" is deprecated
    2026-07-20 12:10:19 | ℹ️ | logging.py:90 | 127.0.0.1:48548 - "GET /api/lightning/list-all-tx?reversed=true HTTP/1.0" 500
    
  • Verified on the same node that lightning-cli decode returns every field from_cln_json consumes; with the patch applied the endpoint returns 200 and the Transactions view loads.

Notes

  • Tests: added regression tests pinning both backends to decode (so decodepay can't sneak back) plus the valid=false → 400 path, and updated the shell-safety test for the new argv.
  • decode predates the v24.11 deprecation by years, so this does not raise the minimum supported CLN version.

🤖 Generated with Claude Code

CLN deprecated decodepay in favor of decode in v24.11, now rejects it by
default (observed on v25.12.1: JSON-RPC -32601 "Command decodepay is
deprecated") and removes it entirely in v26.04. Both CLN implementations
still called decodepay in decode_pay_request(), so on current CLN every
call fails, list_all_tx() propagates the failure, and the
/lightning/list-all-tx endpoint returns HTTP 500 — permanently breaking
the Transactions view in the web UI.

Switch both cln_jrpc.py and cln_grpc.py to decode (the CLI fallback
keyword changes from bolt11= to string=). For bolt11 invoices decode
returns a superset of decodepay fields, so PaymentRequest.from_cln_json
is unchanged. decode reports recognized-but-invalid strings as a normal
result with valid=false + warning_* fields instead of an RPC error, so
both backends now map that case to a clear 400 rather than crashing in
from_cln_json the way fusion44#307 did.

Reproduced on RaspiBlitz v1.12.1 with Core Lightning v25.12.1; verified
on the same node that decode returns every field the parser consumes and
that the Transactions view loads after the patch.

Co-Authored-By: Claude Fable 5 <[email protected]>
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