Skip to content

BOLT11 invoice follows the new spec changes - #10326

Open
MPins wants to merge 5 commits into
lightningnetwork:masterfrom
MPins:issue-9842
Open

MPins wants to merge 5 commits into
lightningnetwork:masterfrom
MPins:issue-9842

Conversation

@MPins

@MPins MPins commented Oct 28, 2025 •

Copy link
Copy Markdown
Contributor

Fixes #9718
Fixes #9842

This PR updates BOLT 11 invoice decoding to follow the current reader requirements of the spec. The length rule was clarified in lightning/bolts#1243.

Changes

  • Fixed-length fields are validated. Decode now fails with ErrInvalidFieldLength if a p, h, s or n field does not have the correct length (52, 52, 52, 53). Previously such fields were silently skipped.
  • Payment secret is required. validateInvoice now rejects invoices without a payment secret (s), unless the invoice has blinded paths, whose final-hop PathID serves the same purpose.

Interaction with #11190

This PR is rebased on top of #11190 (reject duplicate payment hashes). Each field is now parsed before the duplicate check runs:

  • A valid p followed by a second valid p is still rejected with ErrDuplicatePaymentHash.
  • A wrong-length p is rejected with ErrInvalidFieldLength, regardless of whether a valid p came before it.

Since a parsed payment hash can no longer be nil, invoice.PaymentHash != nil is enough to detect a duplicate, so the separate paymentHashSeen flag was removed. The #11190 tests that relied on wrong-length fields being skipped now expect ErrInvalidFieldLength.

Compatibility

  • Stricter decoding. Invoices from other implementations that omit s or contain wrong-length fixed fields are now rejected, as the spec requires.

  • Old stored invoices. lnd has set a payment address on every new invoice since v0.9.0 (January 2020). Invoices created by earlier versions have no payment secret and can no longer be decoded. Because invoicesrpc.CreateRPCInvoice decodes the stored payment request, this affects the RPCs that return stored invoices:

    • ListInvoices fails for the whole call if any invoice in the requested range is one of these.
    • LookupInvoice fails for these invoices.
    • SubscribeInvoices fails when it replays them from an old add_index or settle_index.

    The invoices themselves are not touched, and the SQL invoice migration does not decode payment requests, so node startup and payments are unaffected. This is noted in the release notes. If compatibility is wanted, a DecodeOption that skips the payment-secret check could be added and used only in decodePayReq.

  • Router check. The router-side check in extractIntentFromSendRequest ("payment request must contain either a payment address or blinded paths") is now also enforced by the decoder. It is kept as a defense in case the decoder is relaxed.

Tests

  • Existing test vectors. Vectors without a payment secret gain an s field and are re-signed. Vectors that relied on skipping wrong-length fields now expect ErrInvalidFieldLength.
  • New cases. A missing payment secret, and wrong-length p, h, s and n fields.
  • Other packages. Invoices built with NewInvoice in routerrpc and the migration test now set a payment address.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @MPins, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the robustness and compliance of BOLT 11 invoice handling by integrating the latest specification updates. The primary focus is on enforcing strict validation for critical invoice fields, ensuring that payment hashes, payment secrets, and destination public keys meet their specified length requirements. This change prevents the processing of malformed invoices, improving overall network reliability and security.

Highlights

  • BOLT 11 Specification Compliance: The invoice implementation now strictly adheres to the latest BOLT 11 specification changes, ensuring greater interoperability and correctness.
  • Mandatory Field Validation: Enforces validation for mandatory fields ('p', 'h', 's', 'n') to ensure they have their expected base32 lengths (52, 52, 52, 53 respectively).
  • Stricter Error Handling: Instead of silently skipping fields with incorrect lengths, the system now explicitly returns an 'ErrInvalidFieldLength', preventing the processing of malformed invoices.
  • Payment Secret Requirement: Introduces a requirement for a 32-byte payment secret in invoices, unless blinded paths are utilized, enhancing payment security.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request correctly updates the BOLT 11 invoice implementation to align with recent specification changes, enforcing mandatory field length validation for p, h, s, and n fields. Instead of skipping fields with incorrect lengths, the invoice decoding now fails, which improves spec compliance. The changes are well-implemented, with improved error handling in zpay32/decode.go and a new validation check for payment secrets in zpay32/invoice.go. All related tests have been diligently updated to reflect these new, stricter validation rules. The code is clean, adheres to the style guide, and the release notes are clear. Overall, this is a solid contribution.

@erickcestari erickcestari left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

# Technical and Architectural Updates
## BOLT Spec Updates

LND now [fail BOLT-11 payments](https://github.com/lightning/bolts/pull/1243)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: this release notes needs to be at the 0.22 release notes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Release notes at 0.22. Thank you @erickcestari !

@saubyk saubyk added this to the v0.22.0 milestone Jun 9, 2026
@saubyk saubyk added this to lnd v0.22 Jun 9, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in lnd v0.22 Jun 9, 2026
@saubyk saubyk moved this from Backlog to In review in lnd v0.22 Jun 9, 2026
@github-actions github-actions Bot added the severity-medium Focused review required label Jun 10, 2026
@github-actions

Copy link
Copy Markdown

🟡 PR Severity: MEDIUM

Automated classification | 3 files (excl. tests) | 46 lines changed

🟡 Medium (2 files)
  • zpay32/decode.go - BOLT11 invoice decoding logic (zpay32/*)
  • zpay32/invoice.go - Invoice type definitions and helpers (zpay32/*)
🟢 Low (5 files)
  • channeldb/migration_01_to_11/migration_11_invoices_test.go - Test file (*_test.go), 1-line addition
  • docs/release-notes/release-notes-0.22.0.md - Release notes documentation
  • lnrpc/routerrpc/router_backend_test.go - Test file (*_test.go)
  • zpay32/invoice_internal_test.go - Test file (*_test.go)
  • zpay32/invoice_test.go - Test file (*_test.go)

Analysis

The substantive changes in this PR are confined to the zpay32 package, which handles BOLT11 invoice encoding and decoding. Specifically, zpay32/decode.go and zpay32/invoice.go are modified to implement new BOLT11 spec changes. These files fall under the MEDIUM severity tier (zpay32/*).

The remaining files are either test files (classified as LOW per *_test.go rules) or release notes documentation (LOW). The test file in channeldb/migration_01_to_11/ has a single-line addition and is a test file — while the migration path would normally be CRITICAL, test files are classified as LOW.

No severity bump applied: only 3 non-test/non-generated files changed (threshold: 20) and 46 lines changed (threshold: 500).


To override, add a severity-override-{critical,high,medium,low} label.
<!-- pr-severity-bot -->

@MPins

MPins commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor Author

@erickcestari after the rebase the test TestProbePaymentRequestUsesUniqueHashPerLSP is failing payment secret not found.

I will fix the test and include in the commit zpay32: adapt the current tests to the changes

@github-actions github-actions Bot added severity-critical Requires expert review - security/consensus critical and removed severity-medium Focused review required labels Jun 10, 2026
@github-actions

Copy link
Copy Markdown

Warning: Severity changed: severity-medium to severity-critical (files changed since last classification)

PR Severity: CRITICAL

Highest severity file match | 8 files total | 158 additions / 150 deletions

Critical (1 file)
  • channeldb/migration_01_to_11/migration_11_invoices_test.go - matches channeldb/migration* path -- database migration directory files are always classified CRITICAL
Medium (2 files)
  • zpay32/decode.go - zpay32 package
  • zpay32/invoice.go - zpay32 package
Low (1 file)
  • docs/release-notes/release-notes-0.22.0.md - release notes / documentation

Analysis

The PR implements BOLT11 invoice spec changes, with the primary non-trivial code changes in zpay32 (MEDIUM). However, the PR also touches channeldb/migration_01_to_11/migration_11_invoices_test.go, which falls under the channeldb/migration* path. Per classification rules, all files under channeldb/migration* are always CRITICAL -- this elevates the overall PR severity to CRITICAL regardless of the other changes.

The bump rules do not apply here (3 non-test/non-generated files, ~46 lines changed -- well below the 20-file and 500-line thresholds).


To override, add a severity-override-{critical,high,medium,low} label.
<!-- pr-severity-bot -->

@yyforyongyu
yyforyongyu self-requested a review June 10, 2026 21:15
@github-actions github-actions Bot added severity-medium Focused review required and removed severity-critical Requires expert review - security/consensus critical labels Jun 10, 2026
@github-actions

Copy link
Copy Markdown

severity changed: severity-critical to severity-medium (files changed since last classification)

PR Severity: MEDIUM

Automated classification | 3 files | 46 lines changed

Medium (2 files):

  • zpay32/decode.go - zpay32/* package (invoice decoding logic)
  • zpay32/invoice.go - zpay32/* package (invoice data structures)

Low (6 files, excluded from severity):

  • channeldb/migration_01_to_11/migration_11_invoices_test.go - test file
  • docs/release-notes/release-notes-0.22.0.md - release notes documentation
  • lnrpc/routerrpc/router_backend_test.go - test file
  • lnrpc/routerrpc/router_server_test.go - test file
  • zpay32/invoice_internal_test.go - test file
  • zpay32/invoice_test.go - test file

Analysis:

The highest-severity non-test files are in zpay32/*, which maps to MEDIUM severity. The PR modifies zpay32/decode.go and zpay32/invoice.go (invoice decoding and data structures for BOLT-11 invoices).

No severity bump applies: only 3 non-excluded, non-auto-generated files changed (under the 20-file threshold), and 46 non-excluded lines changed (well under the 500-line threshold).

The previous severity-critical label was incorrect. While the PR touches a test file under channeldb/migration_01_to_11/, that file is a *_test.go (LOW), not an actual migration. The substantive changes are confined to zpay32/.

To override, add a severity-override-{critical,high,medium,low} label.
<!-- pr-severity-bot -->

@erickcestari erickcestari left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The new changes LGTM!

Comment thread zpay32/invoice.go Outdated

@yyforyongyu yyforyongyu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very close! Think we just need another round to fix the findings and release notes.

Comment thread zpay32/decode.go Outdated
Comment thread zpay32/invoice_test.go Outdated
@github-actions github-actions Bot added severity-critical Requires expert review - security/consensus critical and removed severity-medium Focused review required labels Jun 18, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Severity changed: CRITICAL → MEDIUM (files changed since last classification)

🟡 PR Severity: MEDIUM

gh pr view | 8 files | 324 lines changed (164 additions / 160 deletions)

🟡 Medium (2 files)
  • zpay32/decode.go - BOLT11 invoice decoding logic; part of zpay32/*, categorized MEDIUM
  • zpay32/invoice.go - BOLT11 invoice struct/validation helpers; part of zpay32/*, categorized MEDIUM
🟢 Low (6 files)
  • channeldb/migration_01_to_11/migration_11_invoices_test.go - test-only change (1 line), no modification to actual migration logic
  • docs/release-notes/release-notes-0.22.0.md - release notes update
  • lnrpc/routerrpc/router_backend_test.go - test-only change
  • lnrpc/routerrpc/router_server_test.go - test-only change
  • zpay32/invoice_internal_test.go - test-only change
  • zpay32/invoice_test.go - test-only change

Analysis

This PR ("BOLT11 invoice follows the new spec changes") updates BOLT11 invoice decoding/validation in zpay32/decode.go and zpay32/invoice.go to enforce mandatory field lengths per the updated Lightning spec (bolts PR #1243). These files fall under the zpay32/* package, which is categorized MEDIUM severity (invoice encoding utility, not core wallet/HTLC/contract logic).

The remaining 6 files are test-only changes (*_test.go) or documentation (release-notes-0.22.0.md), which are excluded from severity escalation and file/line-count bump calculations per the classification rules. Notably, migration_11_invoices_test.go only adds a single test assertion and does not modify actual migration logic — it does not trigger the "database migrations are always CRITICAL" rule, since that rule targets migration logic itself, not tests exercising it.

No CRITICAL or HIGH packages (lnwallet, htlcswitch, contractcourt, sweep, peer, keychain, input, channeldb migration logic, funding, lnwire, routing, invoices, discovery, graph, etc.) are touched. Total non-test/non-generated lines changed (~60) and file count (3) are well below the bump thresholds (500 lines / 20 files), and no multiple distinct critical packages are involved, so no severity bump applies.

The previous CRITICAL label appears to have been based on an earlier revision of this PR that likely touched different or additional files; the current file set only warrants MEDIUM.


To override, add a severity-override-{critical,high,medium,low} label.

@litbot-9000

Copy link
Copy Markdown
Collaborator

@yyforyongyu: review reminder
@MPins, remember to re-request review from reviewers when ready

3 similar comments
@litbot-9000

Copy link
Copy Markdown
Collaborator

@yyforyongyu: review reminder
@MPins, remember to re-request review from reviewers when ready

@litbot-9000

Copy link
Copy Markdown
Collaborator

@yyforyongyu: review reminder
@MPins, remember to re-request review from reviewers when ready

@litbot-9000

Copy link
Copy Markdown
Collaborator

@yyforyongyu: review reminder
@MPins, remember to re-request review from reviewers when ready

@litbot-9000

Copy link
Copy Markdown
Collaborator

@yyforyongyu: review reminder
@MPins, remember to re-request review from reviewers when ready

1 similar comment
@litbot-9000

Copy link
Copy Markdown
Collaborator

@yyforyongyu: review reminder
@MPins, remember to re-request review from reviewers when ready

@litbot-9000

Copy link
Copy Markdown
Collaborator

@yyforyongyu: review reminder
@MPins, remember to re-request review from reviewers when ready

@MPins
MPins force-pushed the issue-9842 branch 2 times, most recently from ae70e96 to 324963d Compare September 24, 2026 01:31
@MPins
MPins requested a review from erickcestari September 24, 2026 01:45
@github-actions github-actions Bot added severity-critical Requires expert review - security/consensus critical and removed severity-medium Focused review required labels Sep 24, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Severity changed: MEDIUM → CRITICAL (files changed since last classification)

🔴 PR Severity: CRITICAL

gh pr view | 9 files | 394 lines changed (192 additions / 202 deletions)

🔴 Critical (1 file)
  • channeldb/migration_01_to_11/migration_11_invoices_test.go - matches channeldb/migration* path; per policy, database migration packages are always CRITICAL
🟠 High (1 file)
  • lnrpc/routerrpc/router_backend.go - new file in this revision; falls under lnrpc/* (RPC/API definitions)
🟡 Medium (2 files)
  • zpay32/decode.go - BOLT11 invoice decoding logic (zpay32/*)
  • zpay32/invoice.go - BOLT11 invoice data structures (zpay32/*)
🟢 Low (5 files)
  • docs/release-notes/release-notes-0.22.0.md - release notes documentation
  • lnrpc/routerrpc/router_backend_test.go - test file
  • lnrpc/routerrpc/router_server_test.go - test file
  • zpay32/invoice_internal_test.go - test file
  • zpay32/invoice_test.go - test file

Analysis

This revision adds a new non-test file, lnrpc/routerrpc/router_backend.go, which falls under lnrpc/* (HIGH). Combined with channeldb/migration_01_to_11/migration_11_invoices_test.go, which resides in the channeldb/migration* path (always CRITICAL per policy regardless of test/production status), the overall PR severity is CRITICAL.

Non-test/non-generated file count (4: release notes, router_backend.go, decode.go, invoice.go) and line count (~86) remain below the 20-file/500-line bump thresholds, so no additional bump applies — the CRITICAL rating here comes directly from the migration-path and lnrpc-path rules, not from a size bump.

Reviewers should confirm the router_backend.go change (payment secret handling) is consistent with the zpay32 validation changes, and that the migration test update accurately reflects the old invoice schema.


To override, add a severity-override-{critical,high,medium,low} label.

@erickcestari erickcestari left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice PR! The changes related to BOLT looks all correct to me. There's only the compatibility issue that is worth fixing.

Missing test for this:

This still lets malformed duplicate fixed-length fields through. For p/s/h/n, the duplicate guards above each parser (PaymentHash != nil, PaymentAddr.IsSome(), etc.) run before the length check, so a valid first field followed by an invalid-length duplicate is skipped and the invoice is accepted.

Comment on lines +124 to +126
Invoices created by lnd versions before v0.9.0 have no payment secret and
can no longer be decoded, so RPCs that return stored invoices, such as
`ListInvoices`, fail when these invoices are included.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we should still be able to call those RPC and be compatible. Only paying an invoice without s should be rejected. This also breaks the migration_11_invoices.go if the node as any invoice saved without payment_secret.

The zpay decoder should have an option that skips only the payment-secret check.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point, thanks! I moved the payment secret check out of validateInvoice and into Decode, behind a new WithSkipPaymentSecretCheck() option. Decode stays strict by default, as the spec requires, and invoicesrpc.decodePayReq now uses the option, so ListInvoices, LookupInvoice and SubscribeInvoices still return invoices stored without a payment secret. A test in lnrpc/invoicesrpc/utils_test.go covers this.
Since the check is no longer in validateInvoice, NewInvoice and Encode also stop requiring it.

On the migration: I think migration_11_invoices.go itself is not affected, because it imports the frozen copy in channeldb/migration_01_to_11/zpay32, not the main zpay32 package. Only the test was affected, because it builds the payment request with zpay32.NewInvoice.

One thing that may be worth a look: downstream projects that call zpay32.Decode on stored invoices will also see the strict default. For example, loop's FixFaultyTimestamps in loopdb/sqlite.go runs every time
the database is opened. It decodes stored swap invoices from swaps with a publication deadline up to 2020 and returns an error if decoding fails. If some of those invoices have no payment secret, loopd would need the new option when it bumps its lnd dependency. I couldn't confirm whether such invoices exist in practice, so I'm just flagging it.

options := []func(*zpay32.Invoice){
zpay32.CLTVExpiry(uint64(testCltvDelta)),
zpay32.Description("test"),
zpay32.PaymentAddr([32]byte{}),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This test should pass without adding PaymentAddr

Suggested change
zpay32.PaymentAddr([32]byte{}),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, the test now passes unchanged, since NewInvoice no longer requires a payment secret.

Decode now fails if a field with a fixed length (p, h, s, n) does not
have the correct length (52, 52, 52, 53), as BOLT 11 requires since
lightning/bolts#1243. Previously such fields were skipped.

Each field is parsed before the duplicate check, so a wrong-length field
fails with ErrInvalidFieldLength even if a valid field of the same type
came first. A second valid payment hash is still rejected with
ErrDuplicatePaymentHash, now detected through invoice.PaymentHash
instead of a separate flag, since a parsed payment hash can no longer be
nil.

Decode now also requires a payment secret unless the invoice carries
blinded paths. The new WithSkipPaymentSecretCheck option disables this
check for callers that only display an invoice and never pay it.
Adapt the existing tests to the new behavior of Decode,
parseTaggedFields, parse32Bytes and parseDestination.

Test vectors without a payment secret gain an s field and are re-signed.
Vectors that relied on wrong-length fields being skipped now expect
ErrInvalidFieldLength. The routerrpc tests that decode invoices built
with NewInvoice now set a payment address.
Add decode tests for an invoice without a payment secret and for p, h,
s and n fields with an invalid length.
Invoices created by lnd versions before v0.9.0 have no payment secret.
Since zpay32.Decode now rejects such invoices by default, decodePayReq
uses WithSkipPaymentSecretCheck so that ListInvoices, LookupInvoice and
SubscribeInvoices can still return them. The invoice is only converted
for display here, never paid.
@github-actions github-actions Bot added severity-high Requires knowledgeable engineer review and removed severity-critical Requires expert review - security/consensus critical labels Sep 24, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Severity changed: CRITICAL → HIGH (files changed since last classification)

🟠 PR Severity: HIGH

gh pr view | 10 files | 517 lines changed (311 additions / 206 deletions)

🟠 High (2 files)
  • lnrpc/invoicesrpc/utils.go - part of lnrpc/* (RPC/API definitions)
  • lnrpc/routerrpc/router_backend.go - part of lnrpc/* (RPC/API definitions)
🟡 Medium (2 files)
  • zpay32/decode.go - BOLT11 invoice decoding logic (zpay32/*)
  • zpay32/invoice.go - BOLT11 invoice data structures (zpay32/*)
🟢 Low (6 files)
  • docs/release-notes/release-notes-0.22.0.md - release notes documentation
  • lnrpc/invoicesrpc/utils_test.go - test file
  • lnrpc/routerrpc/router_backend_test.go - test file
  • lnrpc/routerrpc/router_server_test.go - test file
  • zpay32/invoice_internal_test.go - test file
  • zpay32/invoice_test.go - test file

Analysis

The channeldb/migration_01_to_11/migration_11_invoices_test.go file that previously triggered the CRITICAL classification (via the "database migrations are always CRITICAL" rule) is no longer part of this PR's diff, so that rule no longer applies.

The current diff's highest-severity files are lnrpc/invoicesrpc/utils.go and lnrpc/routerrpc/router_backend.go, both non-test production code under lnrpc/*, which maps to HIGH. The core BOLT11 spec changes remain in zpay32/decode.go and zpay32/invoice.go (MEDIUM).

No severity bump applies: 5 non-test/non-generated files changed (threshold: 20) and ~116 non-test lines changed (threshold: 500), and no CRITICAL-tier packages are touched.

Reviewers should confirm the lnrpc/invoicesrpc/utils.go and router_backend.go changes correctly propagate the new payment-secret/field-length validation from zpay32 through to the RPC layer.


To override, add a severity-override-{critical,high,medium,low} label.

@MPins

MPins commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, @erickcestari! I addressed your comments: Decode stays strict by default, and the new WithSkipPaymentSecretCheck() option is used in invoicesrpc.decodePayReq, so the invoice RPCs still return invoices stored without a payment secret. I also added cases for p, s, h and n to TestParseTaggedFields, each covering a valid field followed by a wrong-length duplicate.

@MPins
MPins requested a review from erickcestari September 24, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

severity-high Requires knowledgeable engineer review

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

[feature]: Make sure the BOLT11 invoice encoding follows the new spec changes [feature]: make payment addr/secret required when paying invoices

5 participants