fix: use decode instead of deprecated decodepay in CLN backends#318
Open
sharpone74 wants to merge 1 commit into
Open
fix: use decode instead of deprecated decodepay in CLN backends#318sharpone74 wants to merge 1 commit into
sharpone74 wants to merge 1 commit into
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:CLN deprecated
decodepayin favor ofdecodein 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). Sincedecode_pay_requestis called for every invoice in the payment history,list_all_tx()fails wholesale and/lightning/list-all-txreturns HTTP 500 on every poll — the Transactions view in the web UI is permanently broken against current CLN.Fix
decodeinstead ofdecodepayin bothcln_jrpc.pyandcln_grpc.py(the CLI fallback's keyword changes frombolt11=tostring=). For bolt11 invoicesdecodereturns a superset ofdecodepay's fields, soPaymentRequest.from_cln_jsonneeds no changes.decodereports recognized-but-invalid strings as a normal result withvalid=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 (KeyErrorswallowed by@logger.catch→None→TypeErrorinlist_all_tx), so both backends mapvalid=falseto a clear 400 with the warnings as detail.Reproduction
lightning-cli decodereturns every fieldfrom_cln_jsonconsumes; with the patch applied the endpoint returns 200 and the Transactions view loads.Notes
decode(sodecodepaycan't sneak back) plus thevalid=false→ 400 path, and updated the shell-safety test for the new argv.decodepredates the v24.11 deprecation by years, so this does not raise the minimum supported CLN version.🤖 Generated with Claude Code