AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 15 Bitcoin

lsps-types: add LSPS2 messages and opening fee params

Public commit record

What the developer wrote

Authored by Peter Neuroth

78/100 · Adequate
lsps-types: add LSPS2 messages and opening fee params

Move the LSPS2 messages, `OpeningFeeParams`, `Promise` and
`compute_opening_fee` from plugins/lsps-plugin/src/proto/lsps2.rs into
lsps-types. Promise and fee computation are unchanged here; they are
reworked in their own commits.

`OpeningFeeParams::validate` in the plugin mixed the LSP's HMAC promise
check with the checks every LSP must do. Only the latter move: the
promise format is the LSP's own business and stays with the service.
`validate(now, payment_size)` keeps the order and error mapping of the
plugin (expired -> 201, fee overflow -> 203, fee >= payment size ->
202) and takes `now` from the caller. The unused `receivable` argument
is dropped. New are `check_limits()` for min <= max payment size,
`is_expired_at()`, `check_payment_size()` and `opening_fee()`.

Also add the `unrecognized_or_stale_token` (200) error code from
bLIP-52, which was missing.

Service-only types (policy plugin API, datastore entry, JIT scid
generation, BOLT4 failure codes) stay in the plugin.

Changelog-None
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit is a routine code reorganization for the Core Lightning project. It moves data structures and helper functions related to the LSPS2 (Just-In-Time channel) protocol from one internal plugin file into a shared library module. It also adds validation helpers and one missing error code. There is no indication this fixes or introduces a security vulnerability; it is a structural refactor with tests.

Recommended action

No security action required. Review as normal code-quality refactor. If auditing, verify that the moved validation logic preserves the original error-code mapping and that the service plugin still performs HMAC promise verification before relying on these shared types.

Security signals we found

01

Refactor only: moves existing types/functions without changing their core behavior

02

Adds input-validation helpers for LSPS2 opening fee parameters

03

Adds missing bLIP-52 error code 200 (unrecognized_or_stale_token)

04

Keeps HMAC promise verification in the service plugin rather than exposing it in shared types

05

Includes unit tests for arithmetic overflow and boundary conditions

Risk score

Why this scored 15/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 0/15
Confidence 10/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.