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

lightningd: handle amountless invoices in the onchain payment check

Public commit record

What the developer wrote

Authored by Níckolas Goline

73/100 · Adequate
lightningd: handle amountless invoices in the onchain payment check

invoice_check_onchain_payment() compared the received amount against
*details->msat, which is NULL when the invoice was created with
amount_msat="any":

FATAL SIGNAL 11
backtrace: lightningd/invoice.c:971 (invoice_check_onchain_payment)
backtrace: lightningd/chaintopology.c:84 (filter_block_txs)
backtrace: lightningd/chaintopology.c:1020 (add_tip)
backtrace: lightningd/chaintopology.c:1117 (get_new_block)

The HTLC path already checks this; do the same onchain, where an
amountless invoice likewise accepts any amount.

Changelog-Fixed: lightningd: crash when an onchain payment arrived for the fallback address of an invoice created with amount_msat="any".
(cherry picked from commit 6d025a3dab76ec5380474b2a8065c48aec309f33)
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This fix repairs a crash in Core Lightning's invoice handling. When someone paid the on-chain fallback address of an invoice that accepted 'any' amount, the software dereferenced a NULL pointer and died with a fatal signal (segmentation fault). The patch simply skips the amount comparison when no specific amount was set, matching the behavior already used for regular Lightning payments.

Recommended action

Apply the patch. It is a minimal, targeted fix with an accompanying regression test. Nodes accepting on-chain fallback payments for amountless invoices should upgrade to avoid denial-of-service crashes.

Security signals we found

01

NULL-pointer dereference (SIGSEGV) in on-chain invoice payment validation

02

Daemon crash triggered by a normal, allowed invoice configuration (amount_msat='any')

03

Crash occurs during block tip processing, affecting node availability

04

Inconsistent validation: HTLC path already handled amountless invoices, on-chain path did not

Risk score

Why this scored 69/100

Our methodology →
Potential impact 20/30
Exploitability 15/25
Stealth signal 10/15
Affected reach 10/15
Confidence 9/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.