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

bolt12: add pay_for_bolt12_invoice for externally-sourced invoices

Public commit record

What the developer wrote

Authored by Alkamal01

83/100 · Strong
bolt12: add pay_for_bolt12_invoice for externally-sourced invoices

Adds a new pay_for_bolt12_invoice method that pays a BOLT 12 invoice
without requiring it to have been requested through LDK. Unlike the
existing send_payment_for_bolt12_invoice, this method:

- Does not verify that the invoice was previously requested by LDK.
- Accepts a caller-supplied payment_id (no deduplication by invoice).
- Supports an optional partial amount_msats for multi-payer MPP flows,
where multiple senders each contribute a portion of the invoice total.
The onion total_msat is always set to the full invoice amount so the
recipient can validate the MPP payment correctly.

Also adds OptionalBolt12PaymentParams and Bolt12PaymentError, and
deprecates send_payment_for_bolt12_invoice and
manually_handle_bolt12_invoices in favour of the new flow.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit adds a new API, pay_for_bolt12_invoice, that lets users pay a BOLT 12 invoice even if LDK did not originally request it. It is intended for advanced use cases like multi-sender payments and replaces an older, more restrictive API. The change itself is a feature addition with deprecation of old methods, not a fix for an active vulnerability. The main security consideration is that the new API places more responsibility on the caller to verify invoices and avoid duplicate payments; misuse could lead to paying an attacker’s invoice or double-paying, but the commit documents these risks clearly and adds validation for amounts and features.

Recommended action

Review downstream callers of pay_for_bolt12_invoice to ensure they perform invoice verification and payment_id uniqueness. Monitor for migration away from the deprecated send_payment_for_bolt12_invoice and manually_handle_bolt12_invoices. No immediate patch is required; treat as a normal feature release with updated API security assumptions.

Security signals we found

01

New API removes internal invoice-origin verification, shifting trust boundary to caller

02

Documentation explicitly warns caller to verify invoice via Bolt12Invoice::verify_using_metadata and to ensure unique payment_id to avoid duplicate payments

03

Input validation added for zero amount, overpay, and partial-amount-without-MPP

04

Unknown required BOLT 12 features are rejected

05

Deprecated APIs retained with #[allow(deprecated)] in tests and default impls to preserve backward compatibility

Risk score

Why this scored 37/100

Our methodology →
Potential impact 5/30
Exploitability 5/25
Stealth signal 5/15
Affected reach 10/15
Confidence 8/10
Evidence quality 4/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.