LND Patches Integer Overflow That Could Drop Settled HTLCs on Restart
LND's Nov. 11 beta releases fix a 16-bit counter overflow that could make restarted Lightning nodes drop settled HTLCs; no live exploitation shown.

Outputs
LND released v0.21.8-beta and v0.20.8-beta on Nov. 11 with the fix.
A 16-bit unsigned counter wraps to zero at 65,536 stored channel updates while entries still persist to disk.
Fix was merged and backported to v0.21.x and v0.20.x branches on Nov. 5.
A test sequence produced 201 persisted updates after 200 rounds; no live attack or fund loss was established.
The patch rejects oversized lists before commitment advancement, disk writes and record reads.
Lightning Labs shipped two LND beta releases on Nov. 11 that patch a 16-bit integer overflow capable of making a restarted Bitcoin Lightning node omit a previously settled payment contract from its reconstructed channel state. The fix, authored by LND maintainer Olaoluwa Osuntokun, landed in v0.21.8-beta and v0.20.8-beta after a merge on Nov. 5 and backports to the v0.21.x and v0.20.x branches the same day.
What exactly does the flaw do?
The bug sits in how LND counts acknowledged channel updates in persistent storage. The implementation used a 16-bit unsigned counter — a type whose maximum value is 65,536. When the list of stored updates reached that ceiling, the counter wrapped back to zero even though the serializer continued writing every entry to disk.
"At 65,536 entries, the count wraps to zero while the serializer still writes every entry," Osuntokun said.
The consequence emerges only after a restart. The node reads the wrapped counter, interprets the update list as empty, and rebuilds its channel state without a previously settled hashed timelock contract — the conditional payment mechanism that carries funds between Lightning nodes. In plain words: a payment the channel had already processed could silently disappear from the node's own records when it came back online.
How could the list grow that large?
Reaching 65,536 stored entries requires a specific operational sequence: repeated fee updates paired with commitment signatures that arrive without a returned revocation. Each round of that sequence adds an entry to the acknowledged-update list rather than clearing it.
Osuntokun's test of the sequence produced 201 persisted updates after 200 rounds — roughly one stored record per round. Two caveats attach to that figure. The result demonstrates the growth behavior under controlled conditions; it does not establish that any live node was attacked. Nor does the flaw, on the evidence available, prove that a payment was erased or funds were lost in production. It concerns state restoration after a restart, not the settlement itself.
What does the patch change?
The fix operates at three points in the storage path:
- The node rejects an oversized list before it advances its local commitment tail or returns a revocation to its channel peer.
- The serializer rejects an oversized list before writing its bytes to disk, closing the wrap condition at its source.
- The reader now checks older records for consistency and rejects malformed trailing data, guarding nodes that load storage written by prior versions.
The layered design matters operationally. A node that upgraded mid-flight — with an already-swollen list on disk from an older release — still receives protection at read time rather than failing silently. The rejection behavior halts channel advancement rather than permitting a corrupted reconstruction, which trades a stoppage for correctness.
Why the two-branch backport?
Lightning Labs cut the fix into two release lines because LND deployments split across v0.21.x and v0.20.x in production. Backporting on merge day, Nov. 5, compressed the window between disclosure of the internal flaw and available patched builds to under a week for operators on either branch.
For context on scale: 65,536 is the maximum value a 16-bit unsigned integer can hold, and the count is precisely the value at which it wraps. That threshold makes the overflow deterministic rather than probabilistic — any channel whose update list crossed it would store records the counter could no longer describe.
What should operators watch?
The releases are preventive maintenance for a failure mode that is reproducible in tests but not demonstrated in the wild. Operators running LND on either branch can apply v0.21.8-beta or v0.20.8-beta now; nodes that do not upgrade remain exposed to the storage-inconsistency path on restart, though only after sustained update-and-no-revocation sequences that most channels would not organically produce.
via tokenpost.com (Source)
More from Elena Vasquez
Show full bio
Staff writer covering regulation, policy and their impact on crypto and web3 industry at Mempool Brief.
1,878 articles