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

Avoid panic when reorged claims cannot merge

Public commit record

What the developer wrote

Authored by Matt Corallo

78/100 · Adequate
Avoid panic when reorged claims cannot merge

Previously, a deep reorg could resurrect an HTLC package at a height
where it was no longer mergeable with its surviving claim. This caused
`OnchainTxHandler::blocks_disconnected` to panic on an assertion.

When merging fails, we now preserve the resurrected package in
`locktimed_packages` so normal block processing registers and broadcasts
it as an independent claim. Add a regression test covering the reorg and
subsequent broadcast.

Thanks to Kyle W. Santiago for reporting this issue.

Co-authored-by: Elias Rohrer <dev@tnull.de>
✓ 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 fixes a crash bug in the Lightning Dev Kit's on-chain transaction handler. During a deep blockchain reorganization, a previously settled HTLC claim could be 'resurrected' at a block height where it could no longer be combined with a surviving claim. The old code used an assertion that assumed merging would always succeed, so the node would panic and shut down. The fix checks whether merging is possible first; if not, it preserves the resurrected claim so it can be broadcast independently. A regression test reproduces the exact reorg scenario.

Recommended action

Treat this as a security fix and include it in the next maintenance release. Nodes running affected versions should upgrade, especially those operating in environments with non-negligible reorg risk or adversarial counterparty behavior. The regression test should be run in CI.

Security signals we found

01

Assertion/panic in reorg handling path

02

Deep blockchain reorg as trigger condition

03

HTLC claim resurrection after reorg

04

Split aggregated package becomes unmergeable due to differing locktimes

05

Denial-of-service vector: remote party can cause local node crash via on-chain actions

06

Regression test added for the panic condition

Risk score

Why this scored 57/100

Our methodology →
Potential impact 18/30
Exploitability 8/25
Stealth signal 7/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.