Skip to content

bolt12: export DecodeOffer - #11199

Open
usefahmed07 wants to merge 1 commit into
lightningnetwork:masterfrom
usefahmed07:master
Open

usefahmed07 wants to merge 1 commit into
lightningnetwork:masterfrom
usefahmed07:master

Conversation

@usefahmed07

Copy link
Copy Markdown

Description

Exports bolt12.decodeOffer as bolt12.DecodeOffer, mirroring the
existing exported decode functions for the other BOLT 12 messages
(DecodeInvoice, DecodeInvoiceRequest, DecodeInvoiceError).

Currently decodeOffer is unexported and only referenced from the
package's own tests, so there is no public entry point to parse a raw
BOLT 12 offer TLV stream from outside the bolt12 package.

Motivation

bitcoinfuzz, a
differential fuzzing project for Bitcoin/Lightning implementations,
has an open issue to add LND to its deserialize_offer fuzz target
(bitcoinfuzz/bitcoinfuzz#586), which references this work
(#10736). That target needs a public decode
function to call from outside the package, exactly like the ones
already exported for Invoice/InvoiceRequest/InvoiceError.

Changes

  • bolt12/offer.go: rename decodeOffer -> DecodeOffer (doc comment
    updated accordingly).
  • bolt12/offer_test.go, bolt12/invoice_request_test.go: update the
    two internal call-sites to use the new exported name.

No behavioral change - this is a pure rename/export, decoding logic is
untouched. As noted in the function's doc comment, callers that need a
valid offer (not just a syntactically decodable one) should still run
ValidateOfferRead afterwards.

@github-actions github-actions Bot added the severity-medium Focused review required label Sep 18, 2026
@github-actions

Copy link
Copy Markdown

🟡 PR Severity: MEDIUM

gh pr view | 3 files | 8 lines changed

🟡 Medium (1 file)
  • bolt12/offer.go - renames/exports decodeOffer to DecodeOffer (uncategorized package, pure API export, no behavioral change)
🟢 Low (2 files)
  • bolt12/offer_test.go - test-only update to use the new exported name
  • bolt12/invoice_request_test.go - test-only update to use the new exported name

Analysis

This PR exports bolt12.decodeOffer as bolt12.DecodeOffer, mirroring existing exported decode functions (DecodeInvoice, DecodeInvoiceRequest, DecodeInvoiceError) so external fuzzing tooling (bitcoinfuzz) can call it. It is a pure rename/export with no change to decoding logic, touching only 1 non-test file (bolt12/offer.go) and 2 test files that update call-sites. The bolt12 package isn't explicitly listed in the CRITICAL/HIGH tiers, and the change is small and low-risk, so it's classified as MEDIUM under the "other uncategorized Go files" bucket. No file-count or line-count thresholds for a severity bump are met.


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

severity-medium Focused review required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant