Skip to content

decode: don't fail to decode just because a bolt12 invoice has expired. #7890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

rustyrussell
Copy link
Contributor

In fact, there are several places where we try to decode old invoices, and they should all work. The only place we should enforce expiration is when we're going to pay.

This also revealed that xpay wasn't checking bolt11 expiries!

Reported-by: hMsats
Fixes: #7869

Changelog-Fixed: JSON-RPC: decode refused to decode expired bolt12 invoices.

@rustyrussell rustyrussell added this to the v24.11 milestone Nov 30, 2024
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
In fact, there are several places where we try to decode old invoices,
and they should all work.  The only place we should enforce expiration is
when we're going to pay.

This also revealed that xpay wasn't checking bolt11 expiries!

Reported-by: hMsats
Fixes: ElementsProject#7869
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: JSON-RPC: `decode` refused to decode expired bolt12 invoices.
@rustyrussell rustyrussell force-pushed the guilt/fix-decode-expired branch from 40ef072 to 6ccc2dc Compare November 30, 2024 08:44
Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 6ccc2dc

@vincenzopalazzo vincenzopalazzo merged commit b8e5b12 into ElementsProject:master Nov 30, 2024
39 checks passed
@hMsats
Copy link
Contributor

hMsats commented Nov 30, 2024

Copied all the changes and decode now decodes an expired bolt12 invoice correctly.

For xpay

Now:

lightning-cli xpay lnbc3u1pn5kqycsp5qu4fgcfkxjfg55d9aqs2mv34guk7cfwm6eeg624v8hvxsmxzw9espp5twhxl6us5mvsr5a0rl6fzaaa2v3zshufdz8shdc3ry0v5tax4ygqdquw3jhxazlv4u8qunfwfu477rsv9usxqppcqpjrzjqtc63jrkql6ptj8j9sq9jvqzwav5rh4y3p5uugcfdte8kr8aes9kjrrqnqqq90qqqqqqqqqqqqqqraqqjq9qxpqysgq9q2pjhfcka3ad27vqjpqvw88779km7sh2dzsxney90mcf4yu90wkvqf2mw5y8t4al6nhqld97su6smf3e40mrt98rd86kmhy8zy78tqp9fecjp
{
   "code": 207,
   "message": "Invoice expired 216 seconds ago"
}

Before:

lightning-cli xpay lnbc3u1pn5kqycsp5qu4fgcfkxjfg55d9aqs2mv34guk7cfwm6eeg624v8hvxsmxzw9espp5twhxl6us5mvsr5a0rl6fzaaa2v3zshufdz8shdc3ry0v5tax4ygqdquw3jhxazlv4u8qunfwfu477rsv9usxqppcqpjrzjqtc63jrkql6ptj8j9sq9jvqzwav5rh4y3p5uugcfdte8kr8aes9kjrrqnqqq90qqqqqqqqqqqqqqraqqjq9qxpqysgq9q2pjhfcka3ad27vqjpqvw88779km7sh2dzsxney90mcf4yu90wkvqf2mw5y8t4al6nhqld97su6smf3e40mrt98rd86kmhy8zy78tqp9fecjp
{
   "code": 203,
   "message": "Destination said it doesn't know invoice: incorrect_or_unknown_payment_details"
}

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.

Command decode not decoding an expired bolt12 invoice
3 participants