Bitcoin Lightning developers patch bug that could make completed payments disappear
Quick Take
- Bitcoin Lightning developers patched an LND vulnerability that could cause nodes to lose track of settled payment records after restarting.
- The flaw caused a software counter to reset at 65,536 entries, potentially disrupting payment-channel accounting and the accuracy of settlement records.
- Developers identified a way peers could trigger the overflow, but whether any live nodes encountered the bug before the patch remains unknown.
Bitcoin Lightning developers patched a software vulnerability that could cause nodes to lose track of settled payments after a restart, potentially disrupting the accounting records that secure payment channels.
The flaw affected LND, a widely used implementation of Bitcoin's Lightning Network, which enables users to send Bitcoin through payment channels without recording every transaction directly on the blockchain.
Developers released v0.21.8-beta and v0.20.8-beta on Nov. 11 to address the issue, which stemmed from an error in how the software saved and restored channel updates.
The vulnerability could cause a node to reconstruct incomplete payment records after restarting, even when the original information remained stored on its disk.
That failure threatened the consistency of Lightning channels, where participants rely on accurate records to determine which payments have settled and what each party is owed.
According to LND maintainer Olaoluwa Osuntokun, known as Roasbeef, the problem involved a counter that tracked acknowledged updates from a connected Lightning peer.
The software stored the number of entries using a 16-bit unsigned integer, which can represent values only up to 65,535.
Once the list reached 65,536 entries, the counter reset to zero, even though LND continued writing the updates to storage.
Upon restarting, the node could interpret that zero as an empty list and omit a previously settled hashed timelock contract (HTLC), a conditional payment mechanism that helps secure transactions across Lightning channels.
Why written updates could be missing after restart
At 65,536 log entries, LND's old stored count could wrap to zero. The released patch adds write guards and checks older records on load.
Choose the record path
Oversized lists are rejected before commitment progress or revocation, and before serialization writes record bytes.
The fix prevents new oversized logs and conditionally recovers complete older records.
Applies to this unsigned acknowledged update log and its overflow condition. Complete legacy data must pass entry/count checks; malformed data is rejected. No observed exploitation or financial loss is established by the reviewed sources.
Sources
Supporting facts
- Both the v0.21.8-beta and v0.20.8-beta release notes include a fix that rejects oversized unsigned acknowledged update logs and validates records on load to prevent a restart silently dropping previously acknowledged channel updates. [2] [3]
- According to LND maintainer Roasbeef's pull-request explanation, the old unsigned acknowledged remote update list stored its count as a 16-bit unsigned integer; at 65,536 entries the count wrapped to zero even though every entry was written. [1]
- Under that overflow condition, a restart could load an empty update list and omit a previously settled HTLC from reconstructed commitment state, according to the maintainer's explanation. [1]
- The fix rejects an oversized list before advancing the local commitment tail or returning a revocation, and the serializer rejects it before writing bytes. [1]
- For older records with a wrapped count, the updated database reader can recover a complete trailing list after checking its entries and count; malformed trailing data is rejected. [1]
Method
Schematic of the maintainer-described count/content mismatch and the released write and legacy-load checks. Geometry shows control flow, not measured traffic or payment values. Selected states distinguish newly rejected oversized logs from conditional recovery of older records.
Scope
Applies to this unsigned acknowledged update log and its overflow condition. Complete legacy data must pass entry/count checks; malformed data is rejected. No observed exploitation or financial loss is established by the reviewed sources.
CryptoSlateDevelopers identify how Lightning peers could trigger the flaw
The vulnerability became more concerning after developers identified a potential way for connected peers to push the affected update list toward its limit.
In the GitHub discussion, LND collaborator ziggie1984 explained that a peer could repeatedly send transaction fee updates and commitment signatures while withholding a required revocation message.
That behavior allowed the list of pending acknowledgments to grow without being cleared.
The developer reproduced the behavior in a unit test, generating 201 stored updates after 200 rounds of messages.
Crucially, the accumulated entries survived reconnects, suggesting that repeatedly disconnecting and reconnecting would not necessarily prevent the list from eventually reaching the overflow threshold.
The potential weakness matters because Lightning depends on both parties maintaining consistent payment-channel states. Losing track of a settled update could undermine the records used to reconcile channel obligations.
However, the project's disclosures do not identify any confirmed exploitation or financial losses associated with the flaw.
To address the problem, developers introduced checks that prevent oversized update lists from advancing the channel state or being written to storage.
They also modified how LND reads existing records, allowing nodes to recover complete update lists saved by older versions when the underlying data passes validation.
The fix was merged into LND's main development branch on Nov. 5 before being included in both November releases.
Mentioned in this article
Editorial credits
Oluwapelumi values Bitcoin's potential. He imparts insights on a range of topics like DeFi, hacks, mining and culture, underlining transformative power.