Lightning developers patched a bug in LND that could make a node lose track of settled payments after a restart. A counter overflow at 65,536 entries caused the flaw, and developers found a way peers could trigger it. The project's disclosures identify no confirmed exploitation or financial losses.
Developers patched a vulnerability that could cause nodes to lose track of settled payments after a restart. The flaw affected LND, a widely used implementation of the Lightning Network, which lets users send Bitcoin through payment channels without recording every transaction directly on the blockchain.
The team released v0.21.8-beta and v0.20.8-beta on Nov. 11 to fix an error in how the software saved and restored channel updates. Without the fix, a node could rebuild incomplete payment records after restarting, even when the original information remained on its disk.
A 16-bit counter wraps to zero
According to LND maintainer Olaoluwa Osuntokun, known as Roasbeef, the problem involved a counter tracking acknowledged updates from a connected peer. The software stored the number of entries as a 16-bit unsigned integer, which holds values only up to 65,535.
Once the list reached 65,536 entries, the counter reset to zero, even though LND kept writing the updates to storage. After a restart, the node could read 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.
Peers could push the list toward its limit
The risk grew when developers found a way for connected peers to fill the list. LND collaborator ziggie1984 explained in the GitHub discussion that a peer could repeatedly send fee updates and commitment signatures while withholding a required revocation message, so the pending list kept growing.
The developer reproduced the behavior in a unit test, generating 201 stored updates after 200 rounds of messages. The accumulated entries survived reconnects, which suggests that disconnecting and reconnecting would not necessarily stop the list from reaching the overflow threshold.
How the fix works
The patch adds checks that stop oversized update lists from advancing the channel state or being written to storage. It also changes how LND reads existing records, so nodes can recover complete lists saved by older versions when the data passes validation.
The fix was merged into LND's main development branch on Nov. 5 before it shipped in both November releases. Whether any live nodes hit the bug before the patch remains unknown.
Source: CryptoSlate
Trading involves risk.