LDK Fix Targets Lightning Crash Risk That Could Lose Funds
A Nov. 23 fix in the Lightning Development Kit addresses a bug that could leave routing nodes unable to claim incoming funds after a crash and a missed Bitcoin transaction deadline.
The Lightning Development Kit, a library for building Bitcoin Lightning software, merged a fix Nov. 23 for a crash-recovery bug affecting routing nodes that save channel data asynchronously.
A Lightning routing node forwards a payment through one channel and receives the corresponding funds through another. If the incoming channel was force-closed and the node crashed before its recovery data had been fully saved, it could restart without the information needed to claim those funds.
Funds could be lost if the node had already paid the outgoing side of the transaction and its claim on the Bitcoin blockchain failed to confirm before the deadline. Both conditions were required for the loss: the outgoing payment had to succeed and the incoming claim had to miss its deadline.
The fix was merged in pull request No. 5663 on LDK’s main development branch. Before the patch, LDK could mark a recovery update as saved while the underlying storage operation was still in progress. The update now remains pending until the complete channel-monitor data has been written.
The channel monitor stores information that a node can use to recover funds when a channel closes. The revised behavior lets the node use the completed data during recovery.
As of Nov. 29, it had not been confirmed that the fix was included in a tagged LDK release. Rust package versions 0.2.8 and 0.1.14, along with the 0.3.0-rc4 release candidate, were dated Nov. 11, before the patch was merged.
Operators who compile their own Lightning software can check the Cargo lockfile for the exact Lightning library version or Git revision used in their build. They can then verify whether that version includes pull request No. 5663.
Users of packaged applications can check the distributor’s release notes or build records and ask the maintainer whether the fix or a backport is included. The issue applies to integrations that use asynchronous storage for channel data.
Developers who manage their own storage must follow the revised LDK behavior and report that recovery data remains pending until the full channel-monitor write is complete.
A separate recovery tool for Core Lightning can address pending payments after channel data has already been lost. The LDK patch addresses the earlier failure in which the software incorrectly recorded the recovery update as complete.








